LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Closed Thread
  Search this Thread
Old 04-25-2011, 10:15 PM   #1
etika
Member
 
Registered: Dec 2010
Posts: 38

Rep: Reputation: 0
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
 
Old 04-25-2011, 10:34 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,346
Blog Entries: 12

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
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/

Last edited by frankbell; 04-25-2011 at 10:38 PM. Reason: Clarity. More information.
 
Old 04-26-2011, 04:37 AM   #3
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
isn't this a duplicate post? I just answered it, and from the same user
 
Old 04-26-2011, 06:54 AM   #4
savona
Member
 
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 195

Rep: Reputation: 50
Quote:
Originally Posted by 16pide View Post
isn't this a duplicate post? I just answered it, and from the same user
Yes, duplicate:
http://www.linuxquestions.org/questi...orking-877102/
 
Old 04-26-2011, 07:03 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 09:57 PM
cron.hourly Not Working lapidarynewbie Linux - Newbie 4 08-14-2009 09:01 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
cron hourly, daily, cron.d jobs don't execute eggsmartha Linux - General 3 09-17-2007 07:37 PM
script in cron.hourly not running hourly unholy Linux - Software 2 09-19-2006 09:21 PM


All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration