#create the bash script to determine whic Init System my $tmpScript = "/tmp/whichSysInit"; my $whichInit = <<"END"; #!/bin/bash if [[ `/sbin/init --version 2>/dev/null` =~ upstart ]]; then echo using upstart; elif [[ `systemctl` =~ -\.mount ]]; then echo using systemd; elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then echo using sysv-init; else echo cannot tell; fi END open OPT, "> $tmpScript"; print OPT $whichInit; close OPT; chmod 0555, $tmpScript; #run that script to get answer my $rslt= `$tmpScript`; #unlink $tmpScript; # cleanup print " Initialization is $rslt\n"; #react to the result #if ($rslt =~/using\s(?\S+)/){ # my $sysInit= $+{si}; #### /tmp/whichSysInit: 2: /tmp/whichSysInit: [[: not found /tmp/whichSysInit: 1: /tmp/whichSysInit: systemctl: not found /tmp/whichSysInit: 4: /tmp/whichSysInit: [[: not found /tmp/whichSysInit: 6: /tmp/whichSysInit: [[: not found Can not determine System Init mechanism <>. Exiting