-   Linux - Newbie (
-   -   Cronjob..... (

milindpk 05-05-2010 07:29 AM

I am just unable to execute a simple cron job from my fedora machine. I want to halt my machine at a given time every day. Pl. guide me regarding this.



PMP 05-05-2010 07:40 AM

Your cronjob entry Please !!
And which user's crontab is it.

RobertP 05-05-2010 08:03 AM

To set a crontab
crontab -e sets a crontab

crontab -l lists a crontab. Here's one that sets the time hourly

crontab -l
# m h dom mon dow command
37 * * * * /usr/sbin/ntpdate dual

Replace the command with /sbin/shutdown -h now and change the hour and minute field with the time you want to shutdown. If your user has not the privilege of shutting down, you may have to be root to create the entry.

milindpk 05-06-2010 02:57 AM

linux crobjob....

Originally Posted by PMP (Post 3957949)
Your cronjob entry Please !!
And which user's crontab is it.

30 21 * * * /root/

Through root user I am trying to execute the said cronjob.



PMP 05-06-2010 04:41 AM

What is there in

Redirect the stdout and STDERR to a log file to see any possible errors


30 21 * * * /root/  1>>/tmp/halt.log 2>>/tmp/halt.err
Now see these logs after your command executes (after 21:30).

Randeep 05-06-2010 02:25 PM

here is a nice help on cron.

chrism01 05-06-2010 07:52 PM

Also, cron usually has a minimal env, so the default PATH may not include the cmds you want. Its always advisable in cron jobs to use full paths to all cmds & files used.
As above, show us the script content.

All times are GMT -5. The time now is 07:54 AM.