set crontab from a bash script
Hi i want to set a cronjob from shell script
which i can do from command line as:- #crontab -e 12 2 * * * /path/to script How can i set crontab as above from shell script. |
You may try a here document:
Code:
crontab << EOS |
Quote:
but when i put it in a script and try to run it,it show permission denied error. And what EOS means. |
EOS is just a marker. It can be anything you like. Some use EOF..
Did you chmod +x the script? |
Quote:
Thanks for EOS explaination. |
A users crontab may already exist so IMHO best first list contents then add to it:
Code:
export TMPDIR=/tmp |
Quote:
@ac_kumar: regarding here documents, take a look at http://linuxcommand.org/wss0030.php (here called here scripts). |
I think EOS means END OF SCRIPT !
may be same as EOF (End Of File) in C/C++ programming. |
Quote:
|
thanks all for your help.
I am have tested script running with sudo command. |
All times are GMT -5. The time now is 09:32 AM. |