12-11-2002
You can use nohup inside a script if you want to. But I think nohup was really intended to be used from the command line.
Different versions of nohup ignore different signals. Sun actually supplies two different versions. It writes to nohup.out if it can or $HOME/nohup.out if the current directory is not writable. A script that silently invokes nohup might interfer with a user's use of nohup with both writing to the same nohup.out file.
Inside a script, ignoring signals is easy. A script can in effect nohup itself by simply using:
trap "" HUP QUIT
and there is no question about whether or not QUIT is being ignored. Want to ignore TERM too? Just use:
trap "" HUP QUIT TERM
And now you can redirect the output whereever you want leaving nohup.out available for mamual use.
In my above script, you could do:
nohup date &
but
( trap "" HUP QUIT TERM ; exec date > date.out 2>&1 ) &
pretty much does the same thing, but gives me much more control over what is happening. Remember that parentheses start a subshell, so the trap inside the subshell does not affect the outer shell.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all, i am new to shell scripts and have one doubt.
Can we call ava classes/methods from shell scripts? if yes how? (17 Replies)
Discussion started by: girish.sh
17 Replies
2. Shell Programming and Scripting
Hi all,
Can any one help me.......
I just want to run one shell script whenever i am rebooting the server. Is there any easy way to do that????
Thanks,
selva (7 Replies)
Discussion started by: Selva_Kumar
7 Replies
3. Shell Programming and Scripting
Hi all,
I am a very new user for korn scripting and in a process of learning.
i have a .bat file that calls a .vbs file which calls a macro used to convert an excel spread sheet to .csv file...
Now i want to automate this process. I want to call this bat file using a korn script or a korn... (16 Replies)
Discussion started by: bhagya2340
16 Replies
4. Shell Programming and Scripting
Hi all
Im calling a DB procedure as foll
sqlplus -s $DB_USERID/$DB_PASSWD@$DB_NAME<<eof
var var1 VARCHAR2(200);
exec ODAS_BATCH_JOBS_RETRIEVE.retrieve_user_info(:var1);
eof
echo $var1
This echo is giving a blank.
Also in case the package ODAS_BATCH_JOBS_RETRIEVE is in an un compiled... (2 Replies)
Discussion started by: Sam123
2 Replies
5. Shell Programming and Scripting
I have searched the forums and couldn't find my specific issue so I figure that I would post on it.
I am trying to run a simple sql script that spools to a flat file from a unix script.
I have tried to make the call outright from inside of the ksh script as such:
sqlplus... (3 Replies)
Discussion started by: BkontheShell718
3 Replies
6. UNIX for Dummies Questions & Answers
I'm going through my UNIX book and came across a section on Customization and Subprocesses.
Can someone tell me what a subprocess is -- for example, when the book says "Which shell 'thing' are known to subprocesses" what exactly does it mean? The book just talks about it without defining it... (10 Replies)
Discussion started by: Straitsfan
10 Replies
7. Shell Programming and Scripting
Hi,
I have:
# Initialize variables
#!/usr/bin/ksh
FILENM=$1
INDEX=0
# read filename
echo "You are working with the Config file: $FILENM"
while read line
do
echo $line
data=$line
((INDEX=INDEX+1))
done <"$FILENM" (3 Replies)
Discussion started by: Marc G
3 Replies
8. UNIX for Dummies Questions & Answers
I'd like to terminate scripts.
These scripts are not by me, but other persons. These contain other programs such as ping, nmap, arp, etc.
If such a script is running, how can I terminate this script AND all processes called by this script?
These scripts are big so terminating all programs... (4 Replies)
Discussion started by: lordofazeroth
4 Replies
9. Shell Programming and Scripting
all,
i've been reading to try and get an abstract idea of the process effeciency of commands , sed, bash, perl, awk, find, grep, etc
which processes will spawn?, fork?, launch subshell?, etc and under what conditions?
how do you know which commands have the faster and better stdio... (2 Replies)
Discussion started by: f77hack
2 Replies
10. Shell Programming and Scripting
Hi,
I have some .json scripts and azure commands in powershell script and I need to execute this powershell script from unix console by writing a shell script. But these powershell script is under my local for ex. C:\ drive.
Would it be possible to achieve this? And do we need to install... (1 Reply)
Discussion started by: Samah
1 Replies
LEARN ABOUT DEBIAN
suspend
suspend(1) User Commands suspend(1)
NAME
suspend - shell built-in function to halt the current shell
SYNOPSIS
sh
suspend
csh
suspend
ksh
suspend
DESCRIPTION
sh
Stops the execution of the current shell (but not if it is the login shell).
csh
Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su.
ksh
Stops the execution of the current shell (but not if it is the login shell).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5)
SunOS 5.10 15 Apr 1994 suspend(1)