Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi, I am trying to setup a cron job in my Fedora distribution but its not working.
These are the steps I took.
1) Setup a perl script in /home/documents/test.pl - Script just gathers the local time.
2) Setup a cron.test file in /etc/cron.d/
3) Executed the perl script and made sure it wrote to cron.test correctly - It works.
4) Create a cron.job file in /etc/cron.d/
5) I changed the permissions of both these files to RWX. Also changed the group from root to my user name.
6) crontab cron.job(load file to system)
Doesn't seem like the cronjob is working because cron.test never gets written. /etc/log/cron has no entries as well, so it doesn't seem like its entering the function. Can anyone tell me what I'm doing wrong???
I know it is weird, but I have had the problem where the files in /etc/cron.daily (or weekly, hourly,etc) have to contain no dot (.).. If they contain a dot (eg backup.sh) they do not work, but without the dot, (backup) it does... I think it is to do with the way run-parts works....
So try renaming cron.job to cron-job and it should work.!
Yes, I have a perl script that when run, will write to the output file cron.test. I don't see any input in cron.test so I know that the cron job hasn't started correctly. No output is emailed to the user eitehr. I also tried the full path to perl with no luck
Sorry - a bit shorter, cause my browser crashed - and i lost the original message I was going to post....
Test the script as the user, so you know that it works...
Make sure you use full paths for the output file... cron does not run from where you think it might, so relative paths are a bit no-no
Check the user has permission for writing to the output file.
as billymayday said, give full path for perl:
1 * * * * jma /usr/bin/perl /home/documents/test.pl
(determine path to perl by running 'which perl')
Hope these help (if not post the contents of the script test.pl here - there might be something... - feel free to replace security info with example data (foo, bar, USERNAME, PASSWORD, SERVER)
Sure. Here is my test.pl script and my cron-job file that is in my home directory(/home/jma/Documents). I know the script works because when I run it, it writes correctly to "cron.test".
I found no "PATH" statement in the man pages for crontab. Be that as is may, you ask cron to run every minute the job "jma" which seems to be undefined as far as I can see. I don't know whether the "/usr/bin/perl" statement is necessary, so you might try just "/home/jma/Documents/test.pl" in the command field of crontab...
<edit> Ooops, crossposting. Glad you solved it by your own means.
Last edited by JZL240I-U; 05-07-2008 at 01:14 AM.
Reason: crossposting
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.