Sponsored Content
Top Forums Shell Programming and Scripting stoped job using ctrl+z now want to run in nohup Post 302230823 by buffoonix on Sunday 31st of August 2008 04:08:12 PM
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.

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
LPC(8)							    BSD System Manager's Manual 						    LPC(8)

NAME
lpc -- line printer control program SYNOPSIS
lpc [command [argument ...]] DESCRIPTION
The lpc utility is used by the system administrator to control the operation of the line printer system. For each line printer configured in /etc/printcap, lpc may be used to: o disable or enable a printer, o disable or enable a printer's spooling queue, o rearrange the order of jobs in a spooling queue, o find the status of printers, and their associated spooling queues and printer daemons, o change the status message for printer queues (the status message may be seen by users as part of the output of the lpq(1) utility). Without any arguments, lpc will prompt for commands from the standard input. If arguments are supplied, lpc interprets the first argument as a command and the remaining arguments as parameters to the command. The standard input may be redirected causing lpc to read commands from file. Commands may be abbreviated; the following is the list of recognized commands. ? [command ...] help [command ...] Print a short description of each command specified in the argument list, or, if no argument is given, a list of the recognized com- mands. abort {all | printer} Terminate an active spooling daemon on the local host immediately and then disable printing (preventing new daemons from being started by lpr(1)) for the specified printers. bottomq printer [jobspec ...] Take the specified jobs in the order specified and move them to the bottom of the printer queue. Each jobspec can match multiple print jobs. The full description of a jobspec is given below. clean {all | printer} Remove any temporary files, data files, and control files that cannot be printed (i.e., do not form a complete printer job) from the specified printer queue(s) on the local machine. This command will also look for core files in spool directory for each printer queue, and list any that are found. It will not remove any core files. See also the tclean command. disable {all | printer} Turn the specified printer queues off. This prevents new printer jobs from being entered into the queue by lpr(1). down {all | printer ...} -msg message ... down {all | printer} message ... Turn the specified printer queue off, disable printing and put message in the printer status file. When specifying more than one printer queue, the -msg argument is required to separate the list of printers from the text that will be the new status message. The message does not need to be quoted, the remaining arguments are treated like echo(1). This is normally used to take a printer down, and let other users find out why it is down (the lpq(1) utility will indicate that the printer is down and will print the status mes- sage). enable {all | printer} Enable spooling on the local queue for the listed printers. This will allow lpr(1) to put new jobs in the spool queue. exit quit Exit from lpc. restart {all | printer} Attempt to start a new printer daemon. This is useful when some abnormal condition causes the daemon to die unexpectedly, leaving jobs in the queue. lpq(1) will report that there is no daemon present when this condition occurs. If the user is the super-user, try to abort the current daemon first (i.e., kill and restart a stuck daemon). setstatus {all | printer} -msg message ... Set the status message for the specified printers. The -msg argument is required to separate the list of printers from the text that will be the new status message. This is normally used to change the status message when the printer queue is no longer active after printing has been disabled, and you want to change what users will see in the output of the lpq(1) utility. start {all | printer} Enable printing and start a spooling daemon for the listed printers. status {all | printer} Display the status of daemons and queues on the local machine. stop {all | printer} Stop a spooling daemon after the current job completes and disable printing. tclean {all | printer} This will do a test-run of the clean command. All the same checking is done, but the command will only print out messages saying what a similar clean command would do if the user typed it in. It will not remove any files. Note that the clean command is a priv- ileged command, while the tclean command is not restricted. topq printer [jobspec ...] Take the specified jobs in the order specified and move them to the top of the printer queue. Each jobspec can match multiple print jobs. The full description of a jobspec is given below. up {all | printer} Enable everything and start a new printer daemon. Undoes the effects of down. Commands such as topq and bottomq can take one or more jobspec to specify which jobs the command should operate on. A jobspec can be: o a single job number, which will match all jobs in the printer's queue which have the same job number. Eg: 17, o a range of job numbers, which will match all jobs with a number between the starting and ending job numbers, inclusive. Eg: 21-32, o a specific userid, which will match all jobs which were sent by that user. Eg: jones, o a host name, when prefixed by an `@', which will match all jobs in the queue which were sent from the given host. Eg: @freebsd.org, o a job range and a userid, separated by a `:', which will match all jobs which both match the job range and were sent by the specified user. Eg: jones:17 or 21-32:jones, o a job range and/or a userid, followed by a host name, which will match all jobs which match all the specified criteria. Eg: jones@freebsd.org or 21-32@freebsd.org or jones:17@freebsd.org. The values for userid and host name can also include pattern-matching characters, similar to the pattern matching done for filenames in most command shells. Note that if you enter a topq or bottomq command as parameters on the initial lpc command, then the shell will expand any pattern-matching characters that it can (based on what files in finds in the current directory) before lpc processes the command. In that case, any parameters which include pattern-matching characters should be enclosed in quotes, so that the shell will not try to expand them. FILES
/etc/printcap printer description file /var/spool/* spool directories /var/spool/*/lock lock file for queue control DIAGNOSTICS
?Ambiguous command abbreviation matches more than one command ?Invalid command no match was found ?Privileged command you must be a member of group "operator" or root to execute this command SEE ALSO
lpq(1), lpr(1), lprm(1), printcap(5), chkprintcap(8), lpd(8) HISTORY
The lpc utility appeared in 4.2BSD. BSD
July 16, 2002 BSD
All times are GMT -4. The time now is 09:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy