stoped job using ctrl+z now want to run in nohup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting stoped job using ctrl+z now want to run in nohup
# 1  
Old 08-30-2008
stoped job using ctrl+z now want to run in nohup

once i have stoped process by ctrl+z then i want to run it again
in nohup plz help me out.
# 2  
Old 08-31-2008
when you press ctrl+z you will get PID
then run
Quote:
nohup -p PID
# 3  
Old 08-31-2008
vidhyadhar pso,

I have already check it its not work

and what work is:
nohup `fg %<jobs_id>`

but i want some command which also work for "sleep 100" type of cmd.
# 4  
Old 08-31-2008
Quote:
nohup -p PID
I haven't yet come across an implementation of nohup which knows a -p option.
But then I don't know every flavour of Unix.
Usually nohup is only executed on startup of a command given as argument but cannot attach to a running process.
If you are running your job control in Bash then you could use the built-in disown command like
Code:
$ echo $0
bash
$ sleep 600 &
[1] 5764
$ disown -h %1

Now you should be able to logout without the shell sending a SIGHUP to your disowned sleep job.

May I refer you to man bash:
Code:
       disown [-ar] [-h] [jobspec ...]
              Without options, each jobspec  is  removed  from  the  table  of
              active  jobs.   If  the  -h option is given, each jobspec is not
              removed from the table, but is marked so that SIGHUP is not sent
              to  the  job  if  the shell receives a SIGHUP.  If no jobspec is
              present, and neither the -a nor the -r option is  supplied,  the
              current  job  is used.  If no jobspec is supplied, the -a option
              means to remove or mark all jobs; the -r option without  a  job‐
              spec  argument  restricts operation to running jobs.  The return
              value is 0 unless a jobspec does not specify a valid job.

# 5  
Old 09-01-2008
Quote:
Originally Posted by RahulJoshi
vidhyadhar pso,

I have already check it its not work

and what work is:
nohup `fg %<jobs_id>`

but i want some command which also work for "sleep 100" type of cmd.
rahul if you observe carefully in AIX type man page for nohup its written clearly..
you can't say whats written in man page is wrong..
you might be doing it wrong.. somethigs are done only by experts..Smilie
# 6  
Old 09-01-2008
here is the proc..
sleep 100
ctrl+z
[1] + Stopped (SIGTSTP) sleep 100
ps
PID TTY TIME CMD
598132 pts/3 0:00 sleep 100
2060484 pts/3 0:00 -ksh
2347048 pts/3 0:00 ps
2449582 pts/3 0:00 -ksh
3076200 pts/3 0:00 -ksh
nohup -p 598132
fg %1 or bg %1
if this won't work change the OS
# 7  
Old 09-01-2008
As remarked recently in another thread, nohup -p appears to be an AIX-only thing.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nohup apending data each time i run script

I have a problem here. i am running my script in nohup but if i run it 2 or three time , in my output i see it is giving me old data as well, in-spite i delete nohup.out file. i tried to look a lot from where the old data is coming. can some one tell me how the old data is also coming again and... (11 Replies)
Discussion started by: mirwasim
11 Replies

2. Shell Programming and Scripting

how do i execute nohup and background job inside the korn script for db2

load_cursor_stmt() { ls /db/admin/ddl/rmn01000/load_cursor*.sql|while read file do echo "${file}" `nohup db2 -tvf "$file" \&` done }Error: ------- /admin/ddl/rmn01000/load_cursor5.sql /db/admin/ddl/rmn01000/load_cursor6.sql + read file + echo... (3 Replies)
Discussion started by: Hangman2
3 Replies

3. UNIX for Dummies Questions & Answers

nohup - sub job in script not executing until I exit

My job is launched using this command: I'm at home and having VPN drops so I used nohup and background. nohup perf_mon -c rating_4_multi,cfg & The main script is PID 26119, and the sub task under it is 26118 which is not running - just sits there. 26119 runs forever but nothing else runs. I... (2 Replies)
Discussion started by: ido1957
2 Replies

4. AIX

Backgroup job using nohup

Hi, I ran a program like following sample.sh & Later I realized that this job will take more hours to complete. Since it consumed 2 hours dat aprocessing and I don't want to terminate and then start the job like nohup sample.sh & Can you please tell me, is it possible to make this job no... (5 Replies)
Discussion started by: shahnazurs
5 Replies

5. UNIX for Dummies Questions & Answers

Run process with nohup every certain time

Hi, I need execute a script every 30 minutes. As might be done without using cron Thx. (6 Replies)
Discussion started by: pepeli30
6 Replies

6. UNIX for Advanced & Expert Users

Find the process was run using nohup or ksh.

Hi, I want to write a script which should be run only on foreground. Is there any way that the script can check itself whether it was run using nohup or ksh and if the user runs the script using nohup then it should prompt the user to run it using ksh? If (The user triggers the script using... (4 Replies)
Discussion started by: RRVARMA
4 Replies

7. Shell Programming and Scripting

Run Script With nohup Command On A Different Server

Hi, I want to run a particular script present in a different server. At the moment I am trying to run it like this: (sleep 3; echo $USERID; sleep 1; echo $PASSWORD ; sleep 1 ; sleep 1 ; echo "nohup perl myscript.pl $* &")| telnet "$server" But the problem is that once the script has... (6 Replies)
Discussion started by: King Nothing
6 Replies

8. UNIX for Dummies Questions & Answers

can't cancel nohup job

Yesterday I started a nohup job called assoc.sh. It has not finished running, but I have realised a problem with my script, so wish to cancel it, modify and restart it. However, I cannot find the PID, so can't cancel it. I have searched the ps list and nothing resembles my job - how can I cancel... (13 Replies)
Discussion started by: polly_falconer
13 Replies

9. Shell Programming and Scripting

nohup in cron job

Hello, I have bunch of shell scripts, which I want to execute every hour in the background. So I created a script mainscript.sh which executes these hourly scripts in the background. Script goes like this. mainscript.sh #!/bin/sh nohup sh subscript1.sh & nohup sh subscrip2.sh & exit 0 ... (5 Replies)
Discussion started by: papachi_2000
5 Replies

10. AIX

Disable ctrl-c,ctrl-d,ctrl-d in ksh script

I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
Discussion started by: wtofu
6 Replies
Login or Register to Ask a Question