Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cronjob is not executing.

4 views
Skip to first unread message

ArifulHossain tuhin

unread,
Feb 1, 2012, 2:46:53 PM2/1/12
to
I have the following shell script

-->cat capture.sh
TIME=$(date +"%H-%M-%d-%m-%y")
IP="203.208.198.29"
PREFIX=$TIME$IP
tshark -f "udp" -i eth0 -w /root/captures/$PREFIX.cap&
pid=$!
sleep 2m
kill $pid

it runs fine when i execute it from shell.

but when i add it to the cron tab nothing happens.

my crontab entry :
1 */2 * 2 3,4,5 sh /root/capture.sh

-->tail /var/log/cron
shows that the command has executed .

but nothing happens. i have set executable permission for "all" for capture.sh and write permission for "all" for /root/captures directory.

Thanks in advance

Bit Twister

unread,
Feb 1, 2012, 3:39:42 PM2/1/12
to
On Wed, 1 Feb 2012 11:46:53 -0800 (PST), ArifulHossain tuhin wrote:
>
> it runs fine when i execute it from shell.

Yup.

> but when i add it to the cron tab nothing happens.

So what is different between cron and your shell.

just for fun, put
env > /tmp/env.list
as your first line and let it run.

While waiting do a
env

cat /etc/crontab

at your terminal prompt.

And then there it this search engine
https://www.google.com/advanced_search

Where you can get more than 300 hits from people posting the same
question.

https://www.google.com/search?q=%22cronjob+is+not+executing%22&hl=en&num=10&lr=&ft=i&cr=&safe=images#hl=en&lr=&tbs=cdr:1,cd_min:2/1/2012,cd_max:2/1/2012&q=cronjob+is+not+executing&start=10&sa=N&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=ac4b69665e0e857a&biw=1118&bih=708

0 new messages