Operating System - HP-UX
1755458 Members
3512 Online
108833 Solutions
New Discussion юеВ

Started jobs immune to hangups

 
wojtek75
Frequent Advisor

Started jobs immune to hangups

HP-UX B.11.11 U 9000/800
ksh Version 11/16/88

Hi,

background jobs are sent a HUP signal while a user is logging out. I can avoid it with
programming some traps in my script or I can start my script with nohup command.

What about the jobs that are already running and haven't been started with nohup and have implemented no traps? Is there a way to make ksh not send SIGHUP to them? I could see a 'disown' command in other shell (i.e.ksh93) but I did find any workaround in ksh88. Does anybody know any solution?

Thank you in advance,
wojtek
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: Started jobs immune to hangups

Use batch(1), at(1) or crontab(1) for long running jobs.

Or it seems nohup or a signal handler for SIGHUP is the way to go.
Or use ksh93 in /usr/dt/bin/dtksh.
wojtek75
Frequent Advisor

Re: Started jobs immune to hangups

Thank you Dennis,

I am aware of that solutions. But what about important jobs that were to finish till the end of my work hours and I have to suddenly go out and logout?

I would like to have these jobs running after my logout despite the fact they were started without nohup and had implemented no hup signals.

I believe there should be a way/program to connect with a process associated with a given PID and make it ignore sighup signals.

I am still waiting for your workarounds.

Regards
Marcin O.
Frequent Advisor

Re: Started jobs immune to hangups

Hello Wojtek75

Sometimes when I must logout but my jobs must still working I use GNU screen program.

- run screen
- do your work
- detach form screen ( screen with your jobs are still working in background)
- logout

- login
- attach to screen and your desktop

Thanks
Marcin
Steven E. Protter
Exalted Contributor

Re: Started jobs immune to hangups

Shalom,

The reason we use cron is so you CAN walk away and go home and know your jobs will still be running.

It is very possible that cron can help your office save money, time and wear and tear on the sysadmin if used.

nohup jobs are immune to hangup.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: Started jobs immune to hangups

>But what about important jobs that were to finish till the end of my work hours and I have to suddenly go out and logout?

If they are important, basically don't do that, the only ones you lost were the ones you started before right now.

You can use dtksh.

>Marcin: Sometimes when I must logout but my jobs must still working I use GNU screen program.

VNC will allow you to do that. Or using a workstation, you just lock the screen.