View previous topic :: View next topic |
Author |
Message |
BigTrucK n00b
Joined: 12 Dec 2004 Posts: 59
|
Posted: Thu Jan 05, 2006 3:48 am Post subject: Weird fcrontab problem |
|
|
I can edit my fcrontab with no problems but for some reason it's just not running my scripts.... when I do a test of:
Code: | * * * * * /bin/echo "hi" |
frcontab outputs hi to ~/dead.letter
But when I go to add a shell script like so:
Code: | 5 * * * * /path/to/shell/script/script.sh |
Nothing happens. Not even entries to dead.letter.
When I run the script using the same exact /path/to/shell/script/script.sh it runs just fine.
Any ideas?? |
|
Back to top |
|
|
mmbrothers Apprentice
Joined: 24 Dec 2005 Posts: 224 Location: Boston
|
Posted: Thu Jan 05, 2006 4:00 am Post subject: |
|
|
Does the script that you are trying to run have any output? If there is not output it will not try to send an email with the results. The dead.letter file is created because fcron cannot successfully send the results email, for whatever reason.
One way to see if fcron is running a script is to look in /var/log/messages. |
|
Back to top |
|
|
kinkos Apprentice
Joined: 07 Feb 2005 Posts: 235 Location: Hoboken, NJ
|
Posted: Thu Jan 05, 2006 4:02 am Post subject: |
|
|
try making your shell script like so:
Code: |
#!/bin/sh
echo "hi"
| just to see if that works (output to dead.letters and all). You could also redirect it like
Code: |
* * * * * /path/to/shell/script/script.sh &> /root/script.sh.output
| with the above script just to check if that works.
HTH. _________________ Open Source, Open Mind |
|
Back to top |
|
|
BigTrucK n00b
Joined: 12 Dec 2004 Posts: 59
|
Posted: Thu Jan 05, 2006 5:49 am Post subject: |
|
|
Thx I will give it a shot... can't figure it out....
Do I have to restart fcron everytime I make changes to fcrontab for a user? |
|
Back to top |
|
|
kinkos Apprentice
Joined: 07 Feb 2005 Posts: 235 Location: Hoboken, NJ
|
Posted: Thu Jan 05, 2006 5:55 am Post subject: |
|
|
Uhmm. I'm not sure I'm pretty sure most crons allow you to do something like this as a user:
Code: |
$ crontab /path/to/users/crontab
| to update the crontab. The service doesn't need to be restarted AFAIK, but it never hurts to read the man page.
HTH. _________________ Open Source, Open Mind |
|
Back to top |
|
|
BigTrucK n00b
Joined: 12 Dec 2004 Posts: 59
|
Posted: Thu Jan 05, 2006 6:05 am Post subject: |
|
|
Do the shell scripts for fcron have to #!/bin/sh? I have mine as #!/bin/bash. |
|
Back to top |
|
|
kinkos Apprentice
Joined: 07 Feb 2005 Posts: 235 Location: Hoboken, NJ
|
Posted: Thu Jan 05, 2006 6:08 am Post subject: |
|
|
No, either or work fine. I merely used sh (i usually use bash) because every system is basically guarenteed to have a working sh, while sometimes bash can be broken. _________________ Open Source, Open Mind |
|
Back to top |
|
|
BigTrucK n00b
Joined: 12 Dec 2004 Posts: 59
|
Posted: Thu Jan 05, 2006 6:10 am Post subject: |
|
|
Gotcha... I tried your 'hi' script setup and it worked just fine.... so fcron is working properly... must be something in my script that's messed up.
Thx for the help! |
|
Back to top |
|
|
kinkos Apprentice
Joined: 07 Feb 2005 Posts: 235 Location: Hoboken, NJ
|
Posted: Thu Jan 05, 2006 6:13 am Post subject: |
|
|
No problem.
If you consider your main issued fixed, please add a "SOLVED" to your subject in the initial post. Helps everyone out a little
~kinkos _________________ Open Source, Open Mind |
|
Back to top |
|
|
BigTrucK n00b
Joined: 12 Dec 2004 Posts: 59
|
Posted: Thu Jan 05, 2006 6:16 am Post subject: |
|
|
Ok here's what my fcrontab -e currently looks like:
Code: |
#Mins Hours Days Months DoW Command
5 * * * * /files/_private/admin/scripts/demons/startChimp.sh
|
And here's the script code:
Code: |
#!/bin/sh
scriptName=startChimp.sh
screenName=irc_chimp
filePath=/files/_private/admin/scripts/commandLines
pid=`screen -list | grep $screenName | awk -F . '{print $1}' | sed -e s/.//`
if [ -z "${pid}" ] ; then
cd $filePath
screen -S $screenName -d -m ./$scriptName
exit 1
else
#echo "Server is running."
exit 0
fi
exit 0
|
when I run startChimp.sh as stated above like /path/to/scripts/startChimp.sh it works just fine, but will not work as entered in fcrontab -e. |
|
Back to top |
|
|
kinkos Apprentice
Joined: 07 Feb 2005 Posts: 235 Location: Hoboken, NJ
|
Posted: Thu Jan 05, 2006 7:02 am Post subject: |
|
|
Hrmm. This is likely silly, but try this: run the script, as you normally do in an xterm or something. Then close the xterm. Does the screen survive?
My last theory is that when the cron process hits the end of the script, it kills any children processes spawned (like the script in the screen; except i thought screen stays alive, so i'm not sure). If thats not it, hopefully someone else will chime in. SOrry _________________ Open Source, Open Mind |
|
Back to top |
|
|
mmbrothers Apprentice
Joined: 24 Dec 2005 Posts: 224 Location: Boston
|
Posted: Thu Jan 05, 2006 1:07 pm Post subject: |
|
|
You could always try adding nohup in front of screen and see if this prevents a hangup.
Code: |
nohup screen -S $screenName -d -m ./$scriptName
|
|
|
Back to top |
|
|
|