lib/scripts/system.pl
author wenzelm
Mon, 16 Feb 2009 21:23:33 +0100
changeset 29758 7a3b5bbed313
parent 29145 b1c6f4563df7
child 34197 aecdcaaa8ff3
permissions -rw-r--r--
removed rudiments of glossary;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26092
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     1
#
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     2
# Author: Makarius
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     3
#
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     4
# system.pl - invoke shell command line (with robust signal handling)
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     5
#
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     6
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     7
# args
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     8
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
     9
($group, $script_name, $pid_name, $output_name) = @ARGV;
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    10
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    11
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    12
# process id
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    13
26096
783f957dcb01 replaced setpgrp by more elaborate setsid;
wenzelm
parents: 26092
diff changeset
    14
if ($group eq "group") {
783f957dcb01 replaced setpgrp by more elaborate setsid;
wenzelm
parents: 26092
diff changeset
    15
  use POSIX "setsid";
26107
4b5e5fc1d11f removed junk;
wenzelm
parents: 26096
diff changeset
    16
  POSIX::setsid || die $!;
26096
783f957dcb01 replaced setpgrp by more elaborate setsid;
wenzelm
parents: 26092
diff changeset
    17
}
26092
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    18
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    19
open (PID_FILE, ">", $pid_name) || die $!;
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    20
print PID_FILE "$$\n";
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    21
close PID_FILE;
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    22
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    23
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    24
# exec script
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    25
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    26
$SIG{'INT'} = "DEFAULT";   #paranoia setting, required for Cygwin
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    27
exec qq/exec bash '$script_name' > '$output_name'/;
260cca2e16fa system.pl - invoke shell command line (with robust signal handling);
wenzelm
parents:
diff changeset
    28