Computing.Net > Forums > Linux > why cronjob doesn't work

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

why cronjob doesn't work

Reply to Message Icon

Name: michael
Date: December 5, 2001 at 12:24:22 Pacific
Comment:

I am just wondering why the cronjob in linux system doesn't work. I run the script it works fine, but if I add script to crontab it fails to run.
(00 12 * * * /usr/local/scriptname 1>/dev/null 2>/dev/null), I double check the permission of script, it's correct.
Does anybody have solutions?



Sponsored Link
Ads by Google

Response Number 1
Name: danny
Date: December 5, 2001 at 14:54:39 Pacific
Reply:

Make sure to specify the full path for any commands in your script.

EX: "/usr/sbin/useradd" instead of "usradd"



0

Response Number 2
Name: John
Date: December 5, 2001 at 17:03:07 Pacific
Reply:

Make sure that the crond is running:

ps ax |grep crond


0

Response Number 3
Name: michael
Date: December 5, 2001 at 17:17:44 Pacific
Reply:

Crond is running at deamon, I can also use "admin" login to run crontab, however if I use "root" to run crontab, it fails, don't know what's happen.(I use full path, and the script works fine if I run it from command line)


0

Response Number 4
Name: Mik
Date: December 6, 2001 at 01:06:59 Pacific
Reply:

What is failing to work? Does the script itself not start or some commands in the script are failing to run? When you run it in a shell you'll normally have environment variables set. When you run it from the crontab you won't have all the same environment variables. So you'll either have to set them in the crontab file or in the script itself.
Try making the script do something simple like /bin/date >> /dir/scriptdate
or something else which you know will always work.

Mik


0

Response Number 5
Name: danny
Date: December 6, 2001 at 06:25:15 Pacific
Reply:

take a look to the /var/log/cron and make sure the process is executed as per the schedule. If there is really an error in teh script, it should appear in your email.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Just for laugh Recoment a linux distribu...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: why cronjob doesn't work

why squid doesn't work with wccp functio www.computing.net/answers/linux/why-squid-doesnt-work-with-wccp-functio/12260.html

SB awe64 doesn't work on RH8.0 www.computing.net/answers/linux/sb-awe64-doesnt-work-on-rh80/15640.html

Cups through Samba Doesn't Work www.computing.net/answers/linux/cups-through-samba-doesnt-work/17489.html