LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-15-2005, 07:15 PM   #1
ttilt
Member
 
Registered: Dec 2003
Location: Campinas, Brasil
Distribution: slackware 10
Posts: 150

Rep: Reputation: 15
Exclamation crontab doesn't work, but everything is set correctly


i've been looking for an answer for this online for some time but couldn't find anything anywhere..

i need to run a program every mon-fri at 9:03. Say the program is "bla".
My crontab is set correctly as u can see here:

Code:
user$ crontab -l
03 09 * * mon-fri bla
Crond is running as u can see here:
Code:
user$ ps ax | grep crond
 3678 ?        S      0:00 /usr/sbin/crond -l10
and yet the program doesn't run...

I tried many tests to have say xeyes run next minute but they don't work either, so it's not a problem w/ the program.

Any suggestions?
 
Old 06-15-2005, 07:54 PM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 47
Here is an example of my crontab file to send an email of my ~/tmp directory to my email everday at 5:10pm. Make sure your using 24hr time. cron seems correct just test the program path before adding to crontab.

10 17 * * Mon-Fri ls -l ~/tmp | mail -s "directory" kencaz@linuxmail.org

KC
 
Old 06-15-2005, 08:06 PM   #3
ttilt
Member
 
Registered: Dec 2003
Location: Campinas, Brasil
Distribution: slackware 10
Posts: 150

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by kencaz
Here is an example of my crontab file to send an email of my ~/tmp directory to my email everday at 5:10pm. Make sure your using 24hr time. cron seems correct just test the program path before adding to crontab.

10 17 * * Mon-Fri ls -l ~/tmp | mail -s "directory" kencaz@linuxmail.org

KC
it's not a problem w/ the program or the path, because on this small xeyes test, to run next minute:
Code:
07 22 * * mon-fri xeyes
xeyes doesn't come up either, and i have it installed of course. Putting the full path to xeyes also doesn't help:
Code:
07 22 * * mon-fri /usr/X11R6/bin/xeyes
any more suggestions?
 
Old 06-15-2005, 08:56 PM   #4
msound
Member
 
Registered: Jun 2003
Location: SoCal
Distribution: CentOS
Posts: 465

Rep: Reputation: 30
im not really a crontab expert but my script looks something like this.

30 21 * * 1 root sh /opt/tools/myscript.sh
30 21 * * 2 root sh /opt/tools/myscript.sh
30 21 * * 3 root sh /opt/tools/myscript.sh
30 21 * * 4 root sh /opt/tools/myscript.sh
30 21 * * 5 root sh /opt/tools/myscript.sh

In my setup a run a file "myscript.sh" every mon-fri at 9:30pm. Its worked great so far.
 
Old 06-15-2005, 09:43 PM   #5
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 61
Quote:
xeyes doesn't come up either,
As far as I know, cron can't deal with X applications. Try putting the following command in your crontab:
Code:
07 22 * * mon-fri /home/ttilt/myScript.sh
where myScript.sh contains the following:
Code:
#!/bin/sh
touch /home/ttilt/cronTest
This will create an empty file in your home directory at 7:22 on weekday mornings.

I hope this helps
--Ian
 
Old 06-15-2005, 10:06 PM   #6
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 47
obvious, but does /home/ttilt/myScript.sh have execute permission.

KC
 
Old 06-15-2005, 10:39 PM   #7
ttilt
Member
 
Registered: Dec 2003
Location: Campinas, Brasil
Distribution: slackware 10
Posts: 150

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by kencaz
obvious, but does /home/ttilt/myScript.sh have execute permission.

KC
the script that I was trying to run is executable yes, I can exec it manually.
 
Old 06-16-2005, 01:14 AM   #8
GaijinPunch
Member
 
Registered: Aug 2003
Location: Tokyo, Japan
Distribution: Gentoo
Posts: 130

Rep: Reputation: 22
1: Is the cron daemon running?
2: What does your system log say? It's probably got tons of crap in there... try to grep out your script name in the system log.
3: Remember that cron will have a different environment than you, or even the "at -f" command. It's very likely it's running, but something isn't working right.

EDIT:
Also, the easy way to find out if cron is running is to follow IBall's advice with a cheesy little script.

Last edited by GaijinPunch; 06-16-2005 at 01:15 AM.
 
Old 06-16-2005, 04:05 PM   #9
ttilt
Member
 
Registered: Dec 2003
Location: Campinas, Brasil
Distribution: slackware 10
Posts: 150

Original Poster
Rep: Reputation: 15
strange, that little test w/ the cronTest file worked. Yet the other program doesn't work........

i know the file is executable, i provide the full path, i can even start it manually on the cmd line or through an icon on the desktop, so what could be keeping it from starting through the crontab?

is there a way to trace the running of that program or to confirm that crontab is even trying to exec it?

Last edited by ttilt; 06-16-2005 at 04:08 PM.
 
Old 06-16-2005, 05:06 PM   #10
co_bofh
LQ Newbie
 
Registered: Mar 2005
Location: Longmont, Co
Distribution: OpenBSD, Solaris, Red Hat, Ubuntu, OS X, HP-UX, Tru64
Posts: 20

Rep: Reputation: 0
You could mod the script so you get output then change the start times to be every minute or every 5 minutes. Redirect the output to /tmp/output. It doesn't guarentee that it'll work at the specified times, but you'll know you don't have a problem with the script or a default environment issue.

Carl
 
Old 06-16-2005, 05:44 PM   #11
ttilt
Member
 
Registered: Dec 2003
Location: Campinas, Brasil
Distribution: slackware 10
Posts: 150

Original Poster
Rep: Reputation: 15
i figured out the problem!

the prog i was trying to run is really a script that uses java at one point. But since crontab just spawns a new job to handle the program, without setting up the environment in any way, the PATH wasn't set correctly and java wasn't been able to run.

The solution was to do:
Code:
xx xx * * mon-fri bash -l bla
so that i run bash in login mode and the environment gets setup correctly.

thanks to all who tried to help
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Webmin doesn't set things up correctly? pingu Linux - Networking 0 11-24-2005 04:27 AM
why isnt AGPFastWrite Woring on my nvidia system (all seems to be set-up correctly) qwijibow Linux - General 1 10-06-2005 02:29 PM
can't get xorg.conf set correctly lnxmacusr Slackware 3 12-29-2004 06:40 PM
How to set standby correctly? csobrero Linux - Hardware 0 11-15-2004 09:44 PM
How to correctly set date/time? Jakerohs Linux - General 5 01-08-2004 03:48 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration