Hi everyone,
While doing some tests with the glexec "suexec" test program (
http://www.nikhef.nl/grid/lcaslcmaps/glexec/osinterop ) I've noticed
that it provokes some strange behaviour with SGE... Normally after a
job terminates, all child processes are also killed (no matter how
much a user tries to disown them). When using suexec, SGE seems to
fail to kill the child process, leaving the process running on the
node indefinately.
My test scripts are below, does anyone else see this behaviour?
Regards,
Simon
=========== job.sh ===========
#!/bin/sh
# Submit this as a job!
hostname
id
# Uncomment one line below
# This one gets killed at end of job.
#/path/to/job.pl
# This one doesn't.
#/path/to/sutest /path/to/job.pl
=========== job.pl ===========
#!/usr/bin/perl
use POSIX;
unless ($pid = fork) {
unless (fork) {
print $$ . "\n";
#Method from:
# http://stackoverflow.com/questions/766397/ \
# how-can-i-run-a-perl-script-as-a-system-daemon-in-linux
POSIX::setsid or die "setsid failed!";
chdir "/";
umask 0;
foreach (0 .. (POSIX::sysconf (&POSIX::_SC_OPEN_MAX) || 1024))
{ POSIX::close $_ }
open (STDIN, "</dev/null");
open (STDOUT, ">/dev/null");
open (STDERR, ">&STDOUT");
# Run the real executable
exec "/bin/sleep 1h";
die "exec failed!";
}
exit 0;
}
waitpid($pid, 0)
=========== <end> ===========
|