lib/scripts/bash
author wenzelm
Thu May 20 20:20:52 2010 +0200 (2010-05-20)
changeset 37012 106c56e916f8
parent 35024 0faeabd99289
permissions -rwxr-xr-x
enable shell script editor mode;
     1 #!/usr/bin/env perl
     2 #
     3 # Author: Makarius
     4 #
     5 # bash - invoke shell command line (with robust signal handling)
     6 #
     7 
     8 use warnings;
     9 use strict;
    10 
    11 
    12 # args
    13 
    14 my ($group, $script_name, $pid_name, $output_name) = @ARGV;
    15 
    16 
    17 # process id
    18 
    19 if ($group eq "group") {
    20   use POSIX "setsid";
    21   POSIX::setsid || die $!;
    22 }
    23 
    24 open (PID_FILE, ">", $pid_name) || die $!;
    25 print PID_FILE "$$";
    26 close PID_FILE;
    27 
    28 
    29 # exec script
    30 
    31 exec qq/exec bash '$script_name' > '$output_name'/;