- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- how to run .login and .profile file from cron
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2008 11:02 AM
тАО01-30-2008 11:02 AM
how to run .login and .profile file from cron
I want to execute .login file through cron. I want to setup a cron for xyz user. Is following command is correct...
00 2 * * * ./appl/temp/.login
I can run from user login and execute the following is ok.
/appl/temp>./.login
But the following i can not run, getting error.
/appl/temp>./appl/becca/.login
./appl/becca/.login: Command not found.
Pls let me know which is the correct command to setup in cron.
Thanks
mp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2008 11:16 AM
тАО01-30-2008 11:16 AM
Re: how to run .login and .profile file from cron
. /appl/becca/.login
That is dot space slash appl slash becca slash dot login
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2008 11:20 AM
тАО01-30-2008 11:20 AM
Re: how to run .login and .profile file from cron
Not sure what you really are trying to accomplish here. If it is the typicall "I need the users env for a script that is run" then you need to call the profile from within the script in the same manner and make sure to export all variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2008 11:26 AM
тАО01-30-2008 11:26 AM
Re: how to run .login and .profile file from cron
The environment provided by 'cron' to a task is quite sparsely defined. From the manpages for 'crontask' you will see that the PATH variable consists, by default, of only '/usr/bin' and '/usr/sbin' and your ${HOME} directory.
Any environmental variables you need must also be supplied by sourcing (reading) your login profile (a poor way); by sourcing a file of those variables (a good way); or by coding them in the script you run.
Since the typical login .profile has interactive, terminal-oriented commands like 'stty' and 'tset', processing your standard profile leads to "Not a typewriter" messages. Either modify your '.profile' to exclude these when it is not interactive:
if [ -t 0 ]; then
stty ...
fi
...or place your environmental variables in a file that can be sourced by both your .profile and any script that needs it:
. myenv
...Note the dot, followed by whitespace, followd by the filename. That is called 'sourcing' and causes the file named to be read into the current shell's environment without spawning a new shell.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2008 12:09 AM
тАО01-31-2008 12:09 AM
Re: how to run .login and .profile file from cron
files with the name '.login' are often used to set environment variables in CSH-like shells.
These commands won't work well in Bourne-like shells, even when calling the script with the correct syntax.
The cron configuration will (nearly 100%) start each crontab-entry in a posix-shell environment.
If you use tcsh - for example - you would have to use a command line like this:
0 2 * * * tcsh -c 'source xxx/.login; morecommands'
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2008 09:10 AM
тАО01-31-2008 09:10 AM
Re: how to run .login and .profile file from cron
I tried from user login . /appl/temp/.login but i m getting following error.
Following PATH setup for user:-PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/appl/temp
/bin/.: Permission denied.
Regards
MP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2008 09:44 AM
тАО01-31-2008 09:44 AM
Re: how to run .login and .profile file from cron
/bin/.: Permission denied."
A) What shell is the used by the ID you tried?
-and-
B) What *exactly* is in the file /appl/temp/.login?
FWIW: /bin should be a link to /usr/bin anyway, so it hasn't any meaning in this context
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2008 06:27 AM
тАО02-05-2008 06:27 AM
Re: how to run .login and .profile file from cron
i am using C shell and from .login it execute perl scripts.
Anyway i incorporate in sh and it execute from shell scripts.
Thanks
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2008 06:30 AM
тАО02-05-2008 06:30 AM
Re: how to run .login and .profile file from cron
I incorporate the execute scripts in shell.
It work fine.
Thanks
MP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2008 07:08 AM
тАО02-05-2008 07:08 AM
Re: how to run .login and .profile file from cron
your forum profile tells us:
I have assigned points to 19 of 71 responses to my questions.
Here is a link, describing how to submit points:
http://forums11.itrc.hp.com/service/forums/helptips.do?#33
mfG Peter