1843580 Members
2477 Online
110221 Solutions
New Discussion

Re: crontab

 
Jonathan Caplette
Regular Advisor

crontab

Hi guys,

I've an old app home made that when I stop or start it, I need to be absoletly on the console, for what I know... What I wanna do, is to stop/start it via the crontab... But what I tried up to now, didn't worked. I check the env variables and I export them to be sure and nothing worked there...

I there a difference between the console and the cron deamon that can make my script useless????

thanks!
jonathan
7 REPLIES 7
harry d brown jr
Honored Contributor

Re: crontab


Are you checking the tty in your script? If possible can you post your script as an ATTACHMENT so that it might help shed some light on the issue?

live free or die
harry
Live Free or Die
Sanjay_6
Honored Contributor

Re: crontab

Hi Jonathan,

The problem could be that the script you are trying to run is looking for the tty from where it is run. If it does not find console in the tty name, it does not run. This is the only reason i could think of that could prevent the script from running. Else it doesn't matter how it is run and thich terminal it is run from.

Hope this helps.

Regds
Pete Randall
Outstanding Contributor

Re: crontab

Jonathan,

Your environment is pretty much stripped bare in crontab. Make sure you export all the variables you need and use full path names for all the commands you're using.

HTH,
Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: crontab

Without seeing your script it is difficult to know but two possible asnswers come to mind:
1) PATH may need to be set in the script.
2) You are souring a .profile in your script that has stty commands or tabs commands or other interactive commands.

If it ain't broke, I can fix that.
Steve Steel
Honored Contributor

Re: crontab

Hi

If there is a message from cron and you did not i/o redirect everything it will go to elm.

Look in the mailer.

Interactive processes from cron are not a hot idea.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
MANOJ SRIVASTAVA
Honored Contributor

Re: crontab

Hi Jonathan


Also check the mail of the root , mail has got the command run sucessfuly or not sucesfuly from the cron of the root , so you can diagnose it better ,ther should be no difference except that cron gets executed using /usr/sbin/sh ,



Manoj Srivastava
Wilfred Chau_1
Respected Contributor

Re: crontab

make sure you specify a full path to
all commands used in your script.

cron does not read profile to set the
env variable.

also read elm and look for error messages.