Operating System - HP-UX
1833110 Members
3299 Online
110051 Solutions
New Discussion

Re: script started from .profile terminates on logout

 
Mark Tunnell
Advisor

script started from .profile terminates on logout

I have a small sar script that is set to run in the background. If I telnet or ssh to the machine and launch the script it will continue to run after I logout. However, if I add the script to the end of .profile it does launch when I login but then terminates when I logout. How do I run the script automatically on login but allow it to keep running after logging out?
4 REPLIES 4
Pete Randall
Outstanding Contributor

Re: script started from .profile terminates on logout

Have you tried nohup'ing it, or running it in the background?


Pete

Pete
Mark Tunnell
Advisor

Re: script started from .profile terminates on logout

nohup worked!

Thanks very much.
Gordon  Morrison
Trusted Contributor

Re: script started from .profile terminates on logout

Bear in mind that the next time you login, the first one will still be running, and you'll start another one... and another one, and another one...
Presumably you're saving the output to a file. If all these processes are writing to the same file, it will get rather big and messy (not to mention all those processes cluttering up your ps output).

Have you considered running it in the background from an rc?.d startup script?
What does this button do?
Darrel Louis
Honored Contributor

Re: script started from .profile terminates on logout

Mark,

Why are you running it from your .profile and not from cron?
man sadc
Although sar is for checking your server, it can also have an impact on performance.

Darrel