Welcome Guest | Login

crontab question

Hi everyone,

I have several cron tasks and it seems to me they aren't run.
To test it I added simple task to the crontab file:

1 * * * * echo "test"

It should be run every minute but I don't see any output on the screen nor do I get
any mail that the cron was run.

What could be a problem? Is this the problem with cron?

Radoslaw

2007-02-27 03:16 AM

Hi there - that cron task will only run at the 01 of an hour.  You'll need

*/1 * * * * echo "test" >> /home/username/testfile.txt

to really test that out.  

[edit: Rahjaz below points out the correct way - so I added the >>]  

2007-02-27 04:46 AM

I have chosen cron jobs through cpanel and there standard experience where I entered "echo test" command and set it to run every minute. It put this entry in the crontab file:

* * * * * echo "test"

But I don't get any "test" message on screen

What is wrong or what i am doing wrong?

2007-02-27 05:57 AM

Hi there, Please note that you cannot get the output of the cronjobs on console. It is ment to be executed in the backend.

Also note that you shoult not use

* * * * * echo "test"

Because you loose the privilege of running these background jobs by doing this.

Best practice to execute the cronjob every mintue is to store the output to a temporary file as follows :

*/1 * * * * echo "test" >> /home/user/test

This will resolve your issue. Please do let me know if this helps.

2007-02-28 06:43 AM

Hi Rahjaz,

Thanks, it worked. Now I know that my cron jobs are run :) But i would like to know what's that "mailto=" option in the crontab file for. I thought that every time some cron job runs, its output is sent to the mail set with "mailto=". But I never got any mail from cron.

2007-03-01 02:15 PM

Hi there,

The function of the mailto= option is to send the output of the command run by the cron job to the email address mentioned in the mailto directive.

Please make sure that you are giving valid email address.

2007-03-02 04:36 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!