LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cron.hourly not working (https://www.linuxquestions.org/questions/linux-newbie-8/cron-hourly-not-working-877061/)

etika 04-25-2011 09:15 PM

cron.hourly not working
 
hey

iam trying to use cron.hourly

i made a script pl.sh
#!bash
echo "aaaa"|mail -s "mail" abc@gmail.com
now i have made this file under /etc/cron.hourly
and my hourly timer is set in the crontab file
*/5 * * * * root cd / && run-parts --report /etc/cron.hourly
after doing all this i did
sudo service cron stop
sudo service cron start
but its not working

what could be the reason of cron.hourly not working

frankbell 04-25-2011 09:34 PM

Try testing your script directly from the command line.

I think it should start out

#!/bin/bash

You should not have to start and stop cron to make this work. Verify that the script works from the command line before trying to run it from cron.

Once you know the script works, use crontab -e from a terminal to edit your cron settings and point the command to the location of the script. For example, if it's called foo.sh and is in /home/[username]/scripts/, point cron at /home/[username]/scripts/foo.sh.

Make sure the executable bit is turned on.

Crontab -e is the recommended way for editing your crontab.

Here's a good reference on cron:

http://www.linuxhelp.net/guides/cron/

16pide 04-26-2011 03:37 AM

isn't this a duplicate post? I just answered it, and from the same user

savona 04-26-2011 05:54 AM

Quote:

Originally Posted by 16pide (Post 4336515)
isn't this a duplicate post? I just answered it, and from the same user

Yes, duplicate:
http://www.linuxquestions.org/questi...orking-877102/

colucix 04-26-2011 06:03 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.


All times are GMT -5. The time now is 01:51 PM.