1833764 Members
2673 Online
110063 Solutions
New Discussion

background job

 
moon_5
Advisor

background job

Hi all~

I tried to run background job on 11.11

but when I close terminal session,

# nohup sar -d 180 400 > sar.log &

background job also stopped.

what's the problem ??

regards
moon
6 REPLIES 6
lawrenzo_1
Super Advisor

Re: background job

Not sure what you are trying to do with sar -d 180 400.

When I run nohup sar -d 180 400 > sar.log & nothing happens and when I run

# sar -d 180 400

I only get the headings from the output.

you can also do

#at now
sar -d 180 400 > sar.log


this will then give you a PID witht he process running
hello
Steven E. Protter
Exalted Contributor

Re: background job

launch background job:

nohup jobname &

or

jobname &

exit twice in seqeuence to release the terminal session.

ps -ef | grep jobname

to see the process list.

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
moon_5
Advisor

Re: background job

Thank you for reply~

now I using #at now command but is it wrong?

#nohup sar -d 180 400 > sar.log &

then I tried to exit terminal session.

you know this message showed.

#there is running jobs

after that I exit session.

#ps -ef|grep sar -> no process

do I have to set something ??
Stuart Browne
Honored Contributor

Re: background job

Try this..

nohup sar -d 180 400 > sar.log &

then close your emulation session, don't 'exit'.

When you 'exit', the shell makes a reasonable attempt to kill all child processes.

What 'nohup' does, is stops a 'HUP' signal getting to your child process, not a reasonable 'TERM' or 'QUIT'. If you kill (not exit) the shell session, it isn't quite so friendly.

You can try setting 'stty -hupcl', but that probably won't help either.
One long-haired git at your service...
lawrenzo_1
Super Advisor

Re: background job

the at now command is another way to run the job but this is by using the cron daemon.

it is find and you do not need the nohup or & as I previously stated:

# at now
sar -d 180 400 > sar.log


you can also schedule a job using at eg

at
hello
moon_5
Advisor

Re: background job

thank you ~