adding a perl script to cron.daily / cron.d to setup a cron job
Hello,
This is my first post here, I'm practically new to crontabs. I have understood the basic method of writing crontabs and executing them. I need help figuring out how to add a perl script to cron.daily/cron.d scripts. I have looked in all older questions in Forums, but couldn't find the correct method of calling this and having it run at a certain time of the day. Can someone please explain to me how to accomplish the following: 1. I have a perl script that does a mysqldump. The script works from the command line. script at the following location: Code:
/auto_home/userid/scripts/testdump.pl Code:
shell>/auto_home/userid/scripts/testdump.pl 3. My question is: how do i add a perl script to any one directory? Just add a file to the relevant directory with the same name as the script and what do I put in this file? a simple absolute path to the script or does it need anything else? 4. Also, how do I specify the time to run? I would like to test this before setting this up as root and adding it to cron.daily so that it runs at the time given in crontab run-parts. Do I specify the file name under cron.d in crontab -e and will it will? Any syntax that I need to add it in other than Code:
10 12 18 10 * root /etc/cron.d/file_name Please help. |
Quote:
In other words, you're not using it correctly. Quote:
Quote:
1) Edit your personal crontab via: crontab -e (do this as your user, not as root). 2) Add this line: 10 12 18 10 * /auto_home/userid/scripts/testdump.pl 3) Save. 4) Make sure testdump.pl is chmod'd to 755 of course. 5) To get the output of your Perl script, make #2 this instead: 10 12 18 10 * /auto_home/userid/scripts/testdump.pl > /auto_home/path/yourfileblahblah.txt |
so no additions are required to the cron.daily or cron.d folders under /etc?
|
Quote:
Usually, as a user, you keep the script in your directory and edit your crontab. |
questions creating the file
When i entered the command contrab -e, it opened the text editor in a file in /tmp... is that right? and m h dom mon dow mean what? is it min hour _ _ DayOfWeek?
|
minute hour dayofmonth month dayofweek
man crontab for more info |
Got the crontab working
Thanks again for posting helpful information. I finally got this working.
We can now let this thread die. Thanks again! |
All times are GMT -5. The time now is 12:52 PM. |