lib/scripts/system.pl
author wenzelm
Thu, 21 Feb 2008 20:16:02 +0100
changeset 26107 4b5e5fc1d11f
parent 26096 783f957dcb01
child 29145 b1c6f4563df7
permissions -rw-r--r--
removed junk;
     1 #
     2 # $Id$
     3 # Author: Makarius
     4 #
     5 # system.pl - invoke shell command line (with robust signal handling)
     6 #
     7 
     8 # args
     9 
    10 ($group, $script_name, $pid_name, $output_name) = @ARGV;
    11 
    12 
    13 # process id
    14 
    15 if ($group eq "group") {
    16   use POSIX "setsid";
    17   POSIX::setsid || die $!;
    18 }
    19 
    20 open (PID_FILE, ">", $pid_name) || die $!;
    21 print PID_FILE "$$\n";
    22 close PID_FILE;
    23 
    24 
    25 # exec script
    26 
    27 $SIG{'INT'} = "DEFAULT";   #paranoia setting, required for Cygwin
    28 exec qq/exec bash '$script_name' > '$output_name'/;
    29