By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,821 Members | 1,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,821 IT Pros & Developers. It's quick & easy.

can't run a cron job

P: 63
Hi, I'm trying to run my first cron job, probably it's missing something.

I created a perl script just to test, it's called "teste"
Expand|Select|Wrap|Line Numbers
  1. !/usr/bin/perl
  2. open(DATA,">>/home/joao/files/output");
  3. @Now = localtime(time);
  4. print DATA "@Now\n";
  5. exit ;
  6.  
I created the file "teste.cron" with the cron job. it's only a line with:
* * * * * /home/joao/files/teste

I uploaded the cron job with "crontab teste.cron"

Shouldn't this be writing the date and time every minute in the file "output"?

When I run my script manually it writes correctly in the file "output";
If I type "crontab -l" I can see my cron job loaded;

can somebody give me an hand?

thanks,

Joćo
Sep 24 '07 #1
Share this Question
Share on Google+
5 Replies

eWish
Expert 100+
P: 971
I am not sure if you got this issue resolved. If not the there is an article that may help you.
Nov 9 '07 #2

P: 63
thanks for your help. I didn“t solve this problem at the time but get my goal monitoring a folder pernmanently and triggering when occured changes instead of running the code in a cron job. Anyway i'll read the article for further using.


thanks,

Joćo
Nov 9 '07 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
Hi, I'm trying to run my first cron job, probably it's missing something.

I created a perl script just to test, it's called "teste"
Expand|Select|Wrap|Line Numbers
  1. !/usr/bin/perl
  2. open(DATA,">>/home/joao/files/output");
  3. @Now = localtime(time);
  4. print DATA "@Now\n";
  5. exit ;
  6.  
I created the file "teste.cron" with the cron job. it's only a line with:
* * * * * /home/joao/files/teste

I uploaded the cron job with "crontab teste.cron"

Shouldn't this be writing the date and time every minute in the file "output"?

When I run my script manually it writes correctly in the file "output";
If I type "crontab -l" I can see my cron job loaded;

can somebody give me an hand?

thanks,

Joćo
Personally, I would want to see what cron is saying since it runs silently. So, that said, I would change the entry to be:

* * * * * /home/joao/files/teste > /home/joao/files/cronjob.log

and see if the log file shows anything happening.

The entry looks right and the code, aside from having asthetic issues (ie: no "use warnings" or "use strict") seems to look like it would work. Try that and see what is output to the log file.

Regards,

Jeff
Nov 9 '07 #4

100+
P: 296
I want a cron software for Windows.
Feb 6 '08 #5

arne
Expert 100+
P: 315
I want a cron software for Windows.
Did you try to Google for "cron windows"? There seem to be several projects that provide cron functionality on windows.

HTH,
arne
Feb 7 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.