Notify.php
authorAlan Knowles <alan@akkbhome.com>
Sun, 10 Apr 2011 07:59:21 +0000 (15:59 +0800)
committerAlan Knowles <alan@akkbhome.com>
Sun, 10 Apr 2011 07:59:21 +0000 (15:59 +0800)
Notify.php

index e4a5371..9b9163c 100644 (file)
@@ -75,8 +75,10 @@ class Pman_Core_Notify extends Pman
             2 => array("pipe", "w") // stderr is a file to write to
          );
         $php = $_SERVER["_"];
-        $cwd = getcwd(); // same as run on.. (so script should end up being same relatively..)
-        $app = $cwd . '/'. $_SERVER["SCRIPT_NAME"] . '  ' . $this->target . '/'. $id;
+        $sn =  $_SERVER["SCRIPT_NAME"];
+        
+        $cwd = $sn[0] == '/' ? dirname($sn) : dirname(realpath(getcwd() . $sn)) // same as run on.. (so script should end up being same relatively..)
+        $app = $cwd . '/'. basename($_SERVER["SCRIPT_NAME"]) . '  ' . $this->target . '/'. $id;
         $cmd = $php . ' ' . $app. ' &';
         echo $cmd . "\n";
         $pipe = array();