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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-26-2005, 11:15 PM
|
#1
|
Member
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46
Rep:
|
Crontab not working as expected
Hello,
To begin, I have made a file called 'mikecron'. In this file, there is 1 line to set a cron job for the following:
*/5 * * * * /home/mikie/hlds_l/cstrike/hltv_autozipdemos
According to the syntax, this should be a correct line for crontab.
I have a bash script called 'hltv_run':
Code:
#/bin/sh
# hltv_run - Script for starting the HLTV server
# Start crontab for auto zip
crontab -r
crontab mikecron
When I run 'hltv_run'(using ./hltv_run) is executes fine. When I type 'crontab -l' I am able to see my crontab jobs.
Everything seems to be set up correctly however for some reason the job is not executing! If you have any idea why this might not be working, please let me know.
Thanks,
Mike
|
|
|
08-27-2005, 01:57 AM
|
#2
|
LQ Newbie
Registered: May 2005
Location: Sydney, Australia
Distribution: Debian Sarge
Posts: 17
Rep:
|
Do you want crontab to execute that script every 5 minutes? If so this is what I would have used:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/mikie/hlds_l/cstrike/hltv_autozipdemos
|
|
|
08-27-2005, 04:01 AM
|
#3
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
The "FM" on my SimplyMEPIS says that */5 means every 5 min. (Search the man page for the word "step".)
I don't think your problem is your syntax, but rather the name & location of the file -- How did you create the file & what dir did you put it in??
|
|
|
08-27-2005, 04:44 AM
|
#4
|
Member
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372
Rep:
|
I have tested something similar on my FC4 machine and works without problems.
I created a file 'test' with this content:
Code:
* * * * * echo "yes"|mail robert
I executed ' crontab test' and the mails started coming in.
So either one of your scripts aren't working (x-bit not set?) or they don't have anything to do... please create some similar test script to identify if it is cron that is not working . . . Then move on to the next step (having YOUR scripts to be executed). For instance, let your own script explicitly send an e-mail to you that it is being executed, on the first line of the script.
I hope this helps a bit ?
Good luck
Oh, and PS, your first line is not correct, it should read ' #!/bin/bash' instead of ' #/bin/bash' But I guess that's just a minor detail, as your machine will probably pick bash as the interpreter anyway.
Last edited by rhoekstra; 08-27-2005 at 04:46 AM.
|
|
|
08-27-2005, 01:37 PM
|
#5
|
Member
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46
Original Poster
Rep:
|
The script runs fine, I'm not too worried about that. I'm pretty sure the script is in the right spot. Is there a way to check exactly what my absolute path is from the directory with the script? I simply used $HOME and then added my directories on.
Thanks,
Mike
|
|
|
08-27-2005, 02:14 PM
|
#6
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,373
|
"I simply used $HOME and then added my directories on."
cron jobs do not run as either root or user. $HOME for cron is probably null. For sure it is not /root or /home/mikie. So your problem is probably that the absolute path to the command is correct when testing but wrong when running as cron.
-------------------------
Steve Stites
|
|
|
08-27-2005, 08:18 PM
|
#7
|
Member
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46
Original Poster
Rep:
|
I have just tried to run by simply typing:
/home/mikie/hlds_l/cstrike/hltv_autozipdemos
And the file I want does run.
Any ideas...?
|
|
|
08-29-2005, 01:56 PM
|
#8
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
Quote:
Originally posted by archtoad6
I don't think your problem is your syntax, but rather the name & location of the file -- How did you create the file & what dir did you put it in??
|
For the second time: - Where is the "file called 'mikecron'"?
- How did you create it? (What editor???)
Please be so kind as to answer or I cannot help.
|
|
|
All times are GMT -5. The time now is 01:02 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|