cronjobs in ubuntu
hi,
can anyone provide me the link which consists of the steps to alott cron jobs in ubuntu 9.10 server. i googled for this but can't find any appropriate solution for this. thanks in advance, Dinesh. |
Hi. Maybe this is what you are looking for: https://help.ubuntu.com/community/CronHowto. Did it occur some specific issue about cron?
|
hi colucix,
my problem is my cron process is not getting executed.this is the format i had setup cron job. 18 12 * * * init 6 am i wrong.if it is so, please correct me. thanks in advance, Dinesh. |
Hi Dinesh. Your crontab entry states you would like to reboot the machine at 12:18 of every day. Is this correct?
A "problem" is that crontab has a very limited environment (not the same shell environment you get at login). Specifically, the PATH environment variable is limited to /bin:/usr/bin. Since the init command is placed in /sbin, the cron daemon cannot find it. Solution: as a general rule, you have to specify the absolute path of all the commands used in crontab, so that it should read: Code:
18 12 * * * /sbin/init 6 |
Hi colucix,
Thank you very much for your quick reply. As you said we have to mention the path environment, what path have to be mentioned for executing backup command. thanks in advance, Dinesh. |
Hi colucix,
the link you have provided is very useful, now i can able to backup my files through cron job by adding the line PATH=/usr/sbin:/usr/bin:/sbin:/bin at the top of the cron file. thanks & regards, Dinesh. |
Hi Dinesh. Well done! Defining/changing the environment at the beginning of the cron script is another way to workaround the limitations. Note that, if the script calls other scripts you have only to add the export statement:
Code:
export PATH=/usr/sbin:/usr/bin:/sbin:/bin In alternative you can "source" a login script, for example: Code:
. $HOME/.bash_profile Code:
#/bin/bash -l A last note: many insights about the crontab limitations are provided by the following manual pages: Code:
man 5 crontab |
Hi colucix,
Thank you very much. your post is clear to understand,and very helpful. continue your good work. thanks®ards, Dinesh. |
All times are GMT -5. The time now is 10:58 AM. |