06-09-2017
Quote:
Originally Posted by
Don Cragun
Trying to ignore SIGSTOP and SIGKILL produces undefined results, but it is certainly a reasonable first attempt to keep a script running while the author of that script tracks down why their script is being terminated for no obvious reason.
Sorry, but while i could respect that motivation having had to deal for quite some time (my professional "career") with the scripts application providers tend to supply i have to respectfully disagree with you.
Much more common than the motivation "i try to be as circumspect as i can" is the motivation "i cover my backside as good as possible", not to forget the motivation "i make it hard for the sysadmin to understand what i am doing so i can sell consulting hours to the customers". Honestly, you won't believe what i have seen shipped as "production code" in form of shell scripts during my life as an AIX administrator. People showing such code here in the beginners forum would get admonished for it - and rightly so!
So, yes, what you said *could* be a possible motivation for the scripts author. More likely, given the state of the real world, though, is was just for no particular reason at all.
bakunin
10 More Discussions You Might Find Interesting
1. Programming
Hi all,
I need some urgent help.
we are using Dynix/ptx V4.5 on i386, have several processes and instances are running on the box round the clock.we increased the processes recently.
We have coded to handle the signals in our programs.
Recently, we noticed most of our processes are... (2 Replies)
Discussion started by: reddyb
2 Replies
2. HP-UX
Hello,
Nice forum BTW... anyway on to my question.
I am trying to write a korn shell script that will shut down a java VM. The first challenge was how to figure out which java VM to kill, as there can be other java processes running at the same time.
Then I discovered fuser. It says it... (4 Replies)
Discussion started by: adamides
4 Replies
3. Programming
Hello,
I am running a webserver that uses sockets, forks, and children. The parent process listens for connections and the child processes the information.
I am trying to figure out why the code I have below SIGTERM, and SIGKILL never fire. I was messing around with the printfs and doesnt... (11 Replies)
Discussion started by: norelco55
11 Replies
4. Programming
the parent is a process manager in our design, and httpd service is one of its child processes, which is started in foreground mode (with "-D FOREGROUND" options) according to our requirements.
when httpd service is started, one main httpd process and eight sub httpd processes can be found by... (4 Replies)
Discussion started by: aaronwong
4 Replies
5. Shell Programming and Scripting
Dear All
We have JBOSS server running on Linux we need to track Graceful Shutdown(SIGTERM) and Forceful Shutdown(SIGKILL) timestamp and write it into one file, I am new to UNIX Signal processing if is it possible how to detect it?
We generally do
$kill PID For Graceful... (5 Replies)
Discussion started by: mnmonu
5 Replies
6. Programming
I' m note very expert in the reliable manage of signal... but in my server I must manage SIGPIPE for the socket and SIGTERM...
I've wrote this but there is something wrong... Can someone explain me with some example the reliable management of signal??
This is what I've wrote in the server
... (2 Replies)
Discussion started by: italian_boy
2 Replies
7. AIX
Hi Guys,
I tried running the firefox in AIX 6.1 and got the below error..
-bash-3.00# firefox
Could not load program /usr/mozilla/firefox/firefox-bin:
Could not load module /usr/mozilla/firefox/libxul.so.
Dependent module /usr/lib/libgtk-x11-2.0.a(libgtk-x11-2.0.so.0) could not... (0 Replies)
Discussion started by: kkeng808
0 Replies
8. Shell Programming and Scripting
Hello.
Could anyone tell me how can I configure a instance of Shell to ignore the SIGTERM signal? I would really appreciate.
Thanks. (6 Replies)
Discussion started by: razolo13
6 Replies
9. Shell Programming and Scripting
My ksh version is ksh93-
=>rpm -qa | grep ksh
ksh-20100621-3.fc13.i686
I have a simple script which is as below - #cat test_sigterm.sh -
#!/bin/ksh
trap 'echo "removing"' QUIT
while read line
do
sleep 20
done
I am Executing the script From Terminal 1 - 1. The ksh is started... (3 Replies)
Discussion started by: rpoornar
3 Replies
10. AIX
Hello, AIX 7.1 - several NetApp disks already running. Trying to install a new one. Storage folks provision it. I run cfgmgr - nothing. no new disks show up in "lsdev", "sanlun lun show" shows no new device. No errors, just nothing. Storage guys disconnect it and attaches to another aix server -... (5 Replies)
Discussion started by: sid
5 Replies
LEARN ABOUT DEBIAN
shell-quote
SHELL-QUOTE(1p) User Contributed Perl Documentation SHELL-QUOTE(1p)
NAME
shell-quote - quote arguments for safe use, unmodified in a shell command
SYNOPSIS
shell-quote [switch]... arg...
DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands
or files with embedded white space or shell globbing characters safely. Here are a few examples.
EXAMPLES
ssh preserving args
When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and
passes them to "$SHELL -c". This doesn't work as intended:
ssh host touch 'hi there' # fails
It creates 2 files, hi and there. Instead, do this:
cmd=`shell-quote touch 'hi there'`
ssh host "$cmd"
This gives you just 1 file, hi there.
process find output
It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to
split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote:
eval set -- `find -type f -print0 | xargs -0 shell-quote --`
debug shell scripts
shell-quote is better than echo for debugging shell scripts.
debug() {
[ -z "$debug" ] || shell-quote "debug:" "$@"
}
With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can.
save a command for later
shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command
you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are
things the user can't pass through), you can do something like this:
user_switches=
while [ $# != 0 ]
do
case x$1 in
x--pass-through)
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
shift;;
# process other switches
esac
shift
done
# later
eval "shell-quote some-command $user_switches my args"
OPTIONS
--debug
Turn debugging on.
--help
Show the usage message and die.
--version
Show the version number and exit.
AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
AUTHOR
Roderick Schertler <roderick@argon.org>
perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)