LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2004, 08:07 AM   #1
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Rep: Reputation: 15
cron help


I have a cron that is not working and just checked to see if cron is actually running using ps ax| grep cron and I got this message:

867 ? S 0:00 /usr/sbin/cron
5123 pts/0 S 0:00 grep cron


can anyone tell me if this means that it actually running?

Cheers,

Dennis
 
Old 07-02-2004, 08:12 AM   #2
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
Yes it means that cron is running. What crontab are you using /etc/crontab, or a file under /etc/cron.daily|weekly|monthly or a user crontab under /var/spool/cron?
 
Old 07-02-2004, 08:22 AM   #3
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
not really sure just typed crontab cron.txt in the directory that cron.txt is located... when I type crontab -l it shows the crontab that I have setup, it is:

30 9 * * 5 /root/backup/master.txt >> /root/backup 2>&1

I have tried this same one on another machine and it works fine on that one...

BTW... what would be the result if a crontab wasn't running... something like... no crontab scheduled??

Thanks,

Dennis
 
Old 07-02-2004, 08:29 AM   #4
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
No result - your crontab would just not be executed.

You should have cron logfile - usually /var/log/cron, or there maybe a /var/log/cron directory under which there are a few logfiles - 'info', 'errors' and 'warnings'

Do these logs say anything about your particular job? When was the cron log last updated? Can you see jobs being executed recently?
 
Old 07-02-2004, 08:50 AM   #5
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
yup, when I type grep -iR "cron" /var/log I get the results and it show everything that has run and it shows the cron that I set up
 
Old 07-02-2004, 09:06 AM   #6
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
If it shows the cron that you setup - then it means that cron executed the job.

Are you not seeing results? If not, what should happen that is not happening?

You might also want to try and keep the stderr - so remove 2>&1 from the end of the command, that way if there is an error, it will be sent to your mailbox (type mail to read it) and hence help in any diagnosis.

Last edited by ph4nt0m; 07-02-2004 at 09:08 AM.
 
Old 07-02-2004, 09:08 AM   #7
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
I am running the cron to do backups, the results is that I should have a copy of the files saved on an external hard drive connected to the computer... the only problem is that I am not getting the files copied.
 
Old 07-02-2004, 09:13 AM   #8
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
OK we're getting a little further to resolve this now.

When you execute /root/backup/master.txt from the command line - does it work?
 
Old 07-02-2004, 09:26 AM   #9
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
it's kind of big, I am running it now, I will get back to you
 
Old 07-02-2004, 09:36 AM   #10
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
While you're waiting for it, some things to think about:

1. Remember to try and execute via cron, without throwing away the stderr - it may send a useful error to your mail.
2. Ensure that any commands you are running in the script have been declared in a PATH variable - cron will not inherit the environmental variables of your shell, so if you're using any commands that have not been declared in the PATH variable in the script, cron will not be able to find them. (if the script works from the command line it's probably easier to copy the PATH variable declaration from your .bashrc or .bash_profile - wherever it is located for your user).

These may not solve the problem, but they will help troubleshoot and eliminate possible causes.

Last edited by ph4nt0m; 07-02-2004 at 09:37 AM.
 
  


Reply



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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
cron.allow and cron.deny in slackware? tl64 Slackware 5 10-13-2005 09:44 PM
No More Cron Mail, Cron Error? Xhost Linux - General 3 07-26-2004 04:28 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 09:57 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:23 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
Open Source Consulting | Domain Registration