LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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


Reply
  Search this Thread
Old 01-31-2011, 06:09 AM   #1
saini_mw
Member
 
Registered: Jun 2005
Location: On the top of the World
Posts: 114

Rep: Reputation: 15
issues in setting up cron.


Hey Guys,

Just a small query...\

I have a shell script which will backup my system & it works just fine if i run it manually. I put in below entry at the end of /etc/crontab:

01 * * * * /tmp/take-my-backup.sh

It should run the script every hour?? but it just doesn't seem to be doing anything. I have checked that crond service is up and running..have also tried restarting it but still same issue.

System in use is RHEL5.

Thanks in advance.
 
Old 01-31-2011, 06:18 AM   #2
goodhombre
Member
 
Registered: Mar 2010
Location: Ungheni, Rep. Moldova
Distribution: Ubuntu
Posts: 84

Rep: Reputation: 21
Hi,

Try to check /var/log/cron log and search for take-my-backup.sh.
 
Old 01-31-2011, 06:22 AM   #3
mayursingru
Member
 
Registered: Nov 2010
Location: Pune
Distribution: CentOS
Posts: 51

Rep: Reputation: 5
Hi,
are u running this cron job as a 'root' or normal user try this out and let me know if it works
01 * * * * root /tmp/take-my-backup.sh
 
Old 01-31-2011, 06:35 AM   #4
saini_mw
Member
 
Registered: Jun 2005
Location: On the top of the World
Posts: 114

Original Poster
Rep: Reputation: 15
i only see below hourly line every hour:

Jan 31 18:01:01 support crond[11552]: (root) CMD (run-parts /etc/cron.hourly)

nothing else.

will try to run it as root..lets see how it goes.
 
Old 01-31-2011, 06:46 AM   #5
saini_mw
Member
 
Registered: Jun 2005
Location: On the top of the World
Posts: 114

Original Poster
Rep: Reputation: 15
I didn't want to wait for another hour so i changed it to:

*/10 * * * * root /tmp/take-my-backup.sh

& it worked. Have changed it back to:

01 * * * * root /tmp/take-my-backup.sh

& i hope it will work. lets wait and watch...

Thanks a lot guys!
 
Old 01-31-2011, 06:49 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Why don't you drop the script in the
Code:
/etc/cron.hourly
directory?

Kind regards
 
Old 02-01-2011, 07:17 AM   #7
rajivdp
Member
 
Registered: Oct 2008
Posts: 34

Rep: Reputation: 17
Cron while exceute the script will look for the binaries in the PATH variable /usr/bin:/bin. But if you run the script manually it will look for the actual PATH variable which may contains the binaries you are executing in the script.

Try sourcing the resource configuration files that are sourced during login at the top of your script. Typically .bashrc and .bash_profile

Best Regards
Rajiv
 
  


Reply


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
need help with setting up a cron juancha Linux - Newbie 2 11-07-2006 07:28 PM
Issues with cron synapse Slackware 4 07-21-2006 01:00 AM
cron issues kaplan71 Fedora 1 10-26-2005 07:40 AM
Setting a cron nitaish Linux - General 6 11-03-2004 07:43 AM
need help setting up a cron job !! J.I.L. Linux - Software 1 10-19-2003 08:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:44 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