Computing.Net > Forums > Unix > executing .profile in crontab file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

executing .profile in crontab file

Reply to Message Icon

Name: David
Date: June 9, 1999 at 13:07:17 Pacific
Comment:

I execute shell scripts from the crontab file, and I need environment variables to be defined before the execution of the commands. These variables are defined in the .profile, but it doesn't seem to execute.
Is there any way to tell the cron to execute the .profile before each command it runs ?
Thanks in advance.
David



Sponsored Link
Ads by Google

Response Number 1
Name: David Liou
Date: June 9, 1999 at 15:22:30 Pacific
Reply:

I've run into this problem before. What I did was pretty simple.

At the top of my script file I loaded the profile by typing: ". $homepath/.profile" (exclude the quotes). Of course, you will have to define the homepath variable or you can replace that with an explicit path to your profile. The key is using the . command to load the profile.

I hope this saves you the time that I spent trying to figure this out.

David


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: executing .profile in crontab file

Edited entries in Crontab don't run www.computing.net/answers/unix/edited-entries-in-crontab-dont-run/5077.html

deleting rows in a file www.computing.net/answers/unix/deleting-rows-in-a-file/3676.html

Extract the max no. in the File Ext www.computing.net/answers/unix/extract-the-max-no-in-the-file-ext/4485.html