crond environment setting!

Taking care of your Linux box.

crond environment setting!

Postby TheElectron707 » Thu Aug 14, 2003 12:07 pm

I am having a problem, we have a branded server with pre-installed software, prediocally we have to restart the software (only), which we do my the scripts that has been provided to us my the manufacturer. i added an entry in the crontab to schedule the task automatically, but i think that crontab opens a new subshell and our enviroment variables and paths are not present in crontab, so the scripts also do not run. i have tried to add some environment variables and paths, but there are so many and spread that it seems impossible for me to gather up all the environment variables. is there a way that crontab do a USUAL LOGIN so that it automatically gets all the environment variables when it runs the script. we are not concerend about security that much.......all i intend that my crontab runs the script properly.

any help would be approciated.
TheElectron707
TheElectron707
Lance Naik
 
Posts: 28
Joined: Sun Jun 08, 2003 10:46 am
Location: Lahore

Postby if » Thu Aug 14, 2003 9:07 pm

Aslam-o-Aliakum,

could u plz specify... linux distro i mean OS or Software which comes with u'r branded server...
if u find anything which shows my lack of knowledge,
please guide me... thx
------------------------------------
Aslam-o-Aliakum-Wa-Rahmatullah-Wa-Barakatuhu
------------------------------------
if
if
Battalion Quarter Master Havaldaar
 
Posts: 224
Joined: Tue Aug 13, 2002 12:52 pm
WLM: ifhope@hotmail.com
Yahoo Messenger: hope_never@yahoo.com
Location: Islamabad

unix

Postby TheElectron707 » Sun Aug 17, 2003 4:26 pm

we are using DEC Unix (digital Unix).
TheElectron707
TheElectron707
Lance Naik
 
Posts: 28
Joined: Sun Jun 08, 2003 10:46 am
Location: Lahore

Re: crond environment setting!

Postby lambda » Tue Aug 19, 2003 4:55 pm

TheElectron707 wrote:I am having a problem, we have a branded server with pre-installed software, prediocally we have to restart the software (only), which we do my the scripts that has been provided to us my the manufacturer. i added an entry in the crontab to schedule the task automatically, but i think that crontab opens a new subshell and our enviroment variables and paths are not present in crontab, so the scripts also do not run.


the easiest solution to this problem is that you write a script that executes all the commands you type in manually. make that script executable and stick it into crontab.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

environment variables??

Postby TheElectron707 » Sat Aug 23, 2003 12:08 am

The main problem is that when i do a normal login, all the environment vairables and paths are set and i simply run a script file and that runs without any error. while when i run the same script file from the cron that does not execute. i have tried to set the variables in cron but i am unable to find all the environment settings, is there a way i could do a NORMAL login thingy in cron and then run the script.
TheElectron707
TheElectron707
Lance Naik
 
Posts: 28
Joined: Sun Jun 08, 2003 10:46 am
Location: Lahore

Postby fawad » Sat Aug 23, 2003 10:25 am

Can you try wrapping the command in "sh -l -c". For example,

Code: Select all

sh -l -c 'echo $JAVA_HOME'


The -l option is supposed to set up the environment of the command as if it had been executed interactively.[/code]
fawad
Site Admin
 
Posts: 918
Joined: Wed Aug 07, 2002 8:00 pm
ICQ: 17672437
Website: http://www.fawad.net
WLM: fawadhalim@hotmail.com
Yahoo Messenger: fawad2048
AOL: fawadhalim
Location: Addison, IL

Re: environment variables??

Postby lambda » Sun Aug 24, 2003 4:01 am

TheElectron707 wrote:The main problem is that when i do a normal login, all the environment vairables and paths are set and i simply run a script file


create a script that sets those environment variables and then execs the script you want to run. make this new script executable and stick it into cron.

that's what i meant.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron