1819836 Members
3134 Online
109607 Solutions
New Discussion юеВ

.profile

 
SOLVED
Go to solution
Clutier_1
Occasional Advisor

.profile

Hi,
I have a user which have ksh.
i want to use crontab to plan a script which need a variable $SCRIPTS_TOP.
This variable is in .profile (sh) and i don't manage to use it.
5 REPLIES 5
Elmar P. Kolkman
Honored Contributor
Solution

Re: .profile

Start the script with . $HOME/.profile

It is the normal situation that the .profile is not run for crontab scripts.

Another solution might be to have the script run from the crontab of root with:
su - -c <script>

That way the .profile will run too.

Mind that things like stty and tset might hang or break your script!
Every problem has at least one solution. Only some solutions are harder to find.
Mark Grant
Honored Contributor

Re: .profile

if your cron file looks like this

* * * * * export $SCRIPT_TOP=somevalue script_name

You should be OK.
Never preceed any demonstration with anything more predictive than "watch this"
T G Manikandan
Honored Contributor

Re: .profile

include the env variables which are in .profile to the script.
Mark Grant
Honored Contributor

Re: .profile

Sorry, there should have bee a ";" in there (or no "export") as in

* * * * * export $SCRIPT_TOP=somevalue; script_name
Never preceed any demonstration with anything more predictive than "watch this"
Chris Hulihan
Advisor

Re: .profile

Note -- here is some information on how to avoid stty giving error messages when you run your profile in this manner:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=114552