LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-16-2007, 02:15 PM   #1
gammy
LQ Newbie
 
Registered: Aug 2007
Posts: 21

Rep: Reputation: 15
cron not working


I cannot seem to get cron to work on my host.
redhat
# uname -a
Linux seebs11.wes.army.mil 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux

# rpm -q vixie-cron
vixie-cron-4.1-20_EL
# /sbin/service crond status
crond (pid 15437) is running...

Example:

I look in /etc/ and see a cron.deny but no entries in it. There is not a cron.allow.
I can run the script manually and it works..but through cron it never runs nor rights out a log.

As root:
08 11 * * * cat /proc/meminfo >> /tmp/meminfo
08 16 * * * cat /proc/meminfo >> /tmp/meminfo

I have also stopped and started the crond service.

Any ideas?

Last edited by gammy; 10-16-2007 at 02:25 PM. Reason: more information
 
Old 10-16-2007, 02:39 PM   #2
LoneGunman
LQ Newbie
 
Registered: Oct 2007
Distribution: Red Hat ES 4
Posts: 10

Rep: Reputation: 0
Give it the absolute path in the cron: Instead of cat xxxx, try /bin/cat xxx.

That should get ya going.
 
Old 10-16-2007, 02:43 PM   #3
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
cron has a skimpy PATH. As a result programs that run from the command line sometimes fail to run under cron because the program is not found and there is no error message on the screen.

If that is your problem then the easiest way to solve the problem is to use the full pathname for the command in the cron line.

----------------
Steve Stites
 
Old 10-16-2007, 02:55 PM   #4
gammy
LQ Newbie
 
Registered: Aug 2007
Posts: 21

Original Poster
Rep: Reputation: 15
it's not the path...it's something to do with minutes/hour, below works:
* * * * * cat /proc/meminfo >> /tmp/meminfo

Below does NOT work:
45 01 * * * cat /proc/meminfo >> /tmp/meminfo1
45 02 * * * cat /proc/meminfo >> /tmp/meminfo2
45 03 * * * cat /proc/meminfo >> /tmp/meminfo3
45 04 * * * cat /proc/meminfo >> /tmp/meminfo4
45 05 * * * cat /proc/meminfo >> /tmp/meminfo5
45 06 * * * cat /proc/meminfo >> /tmp/meminfo6
45 07 * * * cat /proc/meminfo >> /tmp/meminfo7
45 08 * * * cat /proc/meminfo >> /tmp/meminfo8
45 09 * * * cat /proc/meminfo >> /tmp/meminfo9
45 10 * * * cat /proc/meminfo >> /tmp/meminfo10
45 11 * * * cat /proc/meminfo >> /tmp/meminfo11
45 12 * * * cat /proc/meminfo >> /tmp/meminfo12
45 13 * * * cat /proc/meminfo >> /tmp/meminfo13
45 14 * * * cat /proc/meminfo >> /tmp/meminfo14
45 15 * * * cat /proc/meminfo >> /tmp/meminfo15
45 16 * * * cat /proc/meminfo >> /tmp/meminfo16
45 17 * * * cat /proc/meminfo >> /tmp/meminfo17
45 18 * * * cat /proc/meminfo >> /tmp/meminfo18
45 19 * * * cat /proc/meminfo >> /tmp/meminfo19
45 20 * * * cat /proc/meminfo >> /tmp/meminfo20
45 21 * * * cat /proc/meminfo >> /tmp/meminfo21
45 22 * * * cat /proc/meminfo >> /tmp/meminfo22
45 23 * * * cat /proc/meminfo >> /tmp/meminfo23
45 00 * * * cat /proc/meminfo >> /tmp/meminfo24
 
Old 10-16-2007, 03:22 PM   #5
gammy
LQ Newbie
 
Registered: Aug 2007
Posts: 21

Original Poster
Rep: Reputation: 15
something goofy with time..resolved.
 
Old 10-17-2007, 05:37 AM   #6
linux4begin
LQ Newbie
 
Registered: Oct 2007
Location: India
Distribution: Ubuntu,RedHat,Suse Linux,DEBIAN.
Posts: 17
Blog Entries: 1

Rep: Reputation: 0
Smile use which command to find out the command's original path

Dear

some times what happen, that you need to use the absolute path of command in cron, then it gives you result.

suppose you want to use cat command then first check its absolute path with which command, e.g., whcich cat
it will give you /bin/cat
so now use this path in cron

and also try to set cronjobs with crontab -e command
it will make userwise cronjobs

pl.let us know with your try.
 
Old 10-18-2007, 06:31 PM   #7
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
Quote:
Originally Posted by linux4begin View Post
Dear

some times what happen, that you need to use the absolute path of command in cron, then it gives you result.

suppose you want to use cat command then first check its absolute path with which command, e.g., whcich cat
it will give you /bin/cat
so now use this path in cron

and also try to set cronjobs with crontab -e command
it will make userwise cronjobs

pl.let us know with your try.
Give a try to kcron

http://www.linux-user.de/ausgabe/200...ger/kcron2.gif
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron not working adnanm Linux - Software 3 07-24-2007 07:50 PM
cron.daily, cron.weekly not working mwhite74 Linux - Server 2 06-07-2007 09:51 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Cron not seeming to be working? MadCactus Red Hat 2 09-09-2006 11:31 AM
Cron/at not working Wynd Linux - General 1 09-11-2003 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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