My Launch Daemon doesn’t work despite returning a 0 status


For some reason, the launch daemon I created will not run successfully at system boot. I have tried it as a launch agent but that also doesn't work.

This is my plist located in /Library/LaunchDaemons:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Interestingly, the script does run correctly if executed manually, just not through the daemon. And when running launchctl list after boot, the status for com.inetmac4.status is 0, but the script didn't appear to ever run.

Any help would be greatly appreciated! I've Googled but none of the solutions out there that I've found will work for me.

EDIT: It should be noted that I'm trying to run it on a Mac Pro on 10.8.5

EDIT2: And the script:

#cd /Users/inetmac4/
#python -m SimpleHTTPServer > ~/outfile 2> ~/errfile < /dev/null & disown
cd /Users/inetmac4/Script/VMSTATUS/
./  > ~/outfile 2> ~/errfile < /dev/null & disown`


#  Created by INETMac4 on 9/12/13.

while [  1 ]; do

    sleep 5


use Data::Dumper;

#-- the same command in list context

    my @result = `prlctl list --all`;

    shift @result;
    open (VMSTATUS, '>/Users/inetmac4/Sites/index.html');
    open (USERLOG, '</Users/inetmac4/script/username_log.txt');

    my @user_log = <USERLOG>;
    my @user_log = reverse(@user_log); 
    my @user_status;

    my %hash = ();
    foreach (@user_log){

        my @values = split(/\\/), $_;

        my $computer_name = $values[1];

        if (exists($hash{ $computer_name }) == 0){
            $hash{ $computer_name } = 'true';
            push(@user_status, $_);


    my @user_status_formatted;
    # Replaces domain name with OS type
    foreach (@user_status){
        my @values = split(/\\/), $_;

        if ($values[1] =~ /PSSTEAM-W7VPC/){
            push(@user_status_formatted, $values[0] . '\\' . "Windows 7" . '\\' . $values[2]. '\\' . $values[3])
        if ($values[1] =~ /PSSTEAM-W8VPC/){
            push(@user_status_formatted, $values[0] . '\\' . "Windows 8" . '\\' . $values[2]. '\\' . $values[3])
        if ($values[1] =~ /PSSTEAM-XPVPC/){
            push(@user_status_formatted, $values[0] . '\\' . "Windows XP" . '\\'. $values[2]. '\\' . $values[3])

    #print Dumper %hash;

    #print @result;

    foreach (@result){

        my @columns = split(/\s+/), $_;
        my $name  = $columns[3]." ".$columns[4];
        print VMSTATUS "<b>Virtual Machine: </b>". '<a href="VM_Start_INETMAC4_Windows7.cgi">'.$name."</a></br>\n";
        print VMSTATUS "<b>STATUS:</b> ". $columns[1]."</br>\n";
        if ($name =~ 'Windows 8.1'){
            print VMSTATUS "</br>\n";
        foreach (@user_status_formatted){
            my @values = split(/\\/), $_;

            if ($values[0] =~ 'LOGGEDOUT' && $values[1] =~ $name){
                print VMSTATUS "<b>User:</b> Loggedout/ No user"."\n</br></br>";
            if ($values[1] =~ $name){
                print VMSTATUS "<b>User: </b>  " . $values[2] . "\\" . $values[3]."\n</br></br>";

        print VMSTATUS "<hr>";

    close (VMSTATUS);

Best Answer

For those who don't want to read through the comments, it was a pretty simple fix after Mark gave me a bit of insight.

Initially, I wrote the vmstatus_startup script to call which would then continually refresh the perl script (every 5 seconds). I was attempting to call the shell script from launchctl which just adds layers of complexity.

Instead, calling the perl script directly from the .plist and giving the keep alive key allowed it to run constantly after boot.

Finally, I had to make sure to add the perl directory to the .plist above the location of the script since launchd doens't have a PATH the same way a user does.