#!/usr/bin/php -q get_action()){ // We lock the action $action->begin($r[id]); // We process it $params=array($r["parameters"]); // We exec with the specified user exec("su ".$params["user"]); switch ($r["type"]){ case "CREATE_FILE" : $return=file_put_contents($params["file"],$params["contents"]); break; case "CREATE_DIR" : $return=mkdir($params["dir"])); break; case "DELETE" : $return=exec("rm -rf ".$params["dir"]); break; case "MOVE" : $return=rename($params["src"],$params["dst"]); break; default : break; } // We finished the action, notify the DB $action->finish($r["id"],$return); } // Unlock the script unlink($LOCK_FILE); ?>