LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-26-2005, 10:15 PM   #1
nro
Member
 
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46

Rep: Reputation: 15
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
 
Old 08-27-2005, 12:57 AM   #2
mercyop
LQ Newbie
 
Registered: May 2005
Location: Sydney, Australia
Distribution: Debian Sarge
Posts: 17

Rep: Reputation: 0
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
 
Old 08-27-2005, 03:01 AM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
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??
 
Old 08-27-2005, 03:44 AM   #4
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
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 03:46 AM.
 
Old 08-27-2005, 12:37 PM   #5
nro
Member
 
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46

Original Poster
Rep: Reputation: 15
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
 
Old 08-27-2005, 01:14 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Linux Mint 18
Posts: 7,809

Rep: Reputation: 294Reputation: 294Reputation: 294
"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
 
Old 08-27-2005, 07:18 PM   #7
nro
Member
 
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46

Original Poster
Rep: Reputation: 15
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...?
 
Old 08-29-2005, 12:56 PM   #8
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
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.
 
  


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
S_ISDIR not working as expected. what is going on? zeppelin Programming 8 04-19-2007 10:21 AM
Bandwidth control not working as expected. ALMAM Linux - Networking 7 09-28-2005 06:41 AM
LinkSys EZXS55W not working as expected spaaarky21 Linux - Networking 2 09-05-2004 11:44 PM
chmod u+s not working as expected clinton Linux - Newbie 3 03-19-2004 07:49 PM
up2date not working as expected johnny13 Linux - Newbie 7 07-21-2003 01:15 PM


All times are GMT -5. The time now is 09:56 AM.

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