function checkRestart() { if (if_demo()) { return; } $res = lscandir_without_dot("__path_program_etc/.restart"); if ($res === false) { dprint(".restart does not exist... Creating\n"); lxfile_mkdir("__path_program_etc/.restart"); lxfile_generic_chown("__path_program_etc/.restart", "lxlabs"); } foreach ((array) $res as $r) { if (csb($r, "._restart_")) { $cmd = strfrom($r, "._restart_"); } lunlink("__path_program_etc/.restart/{$r}"); dprint("Restarting {$cmd}\n"); // THe 3,4 etc are the tcp ports of this program, and it should be closed, else some programs will grab it. //exec("/etc/init.d/$cmd restart </dev/null >/dev/null 2>&1 3</dev/null 4</dev/null 5</dev/null 6</dev/null &"); switch ($cmd) { case 'lxcollectquota': exec_justdb_collectquota(); break; case 'openvz_tc': exec_openvz_tc(); break; default: exec_with_all_closed("/etc/init.d/{$cmd} restart"); break; } } }
function checkRestart() { if (if_demo()) { return; } log_log("cron_exec", "Check service restarts...\n"); $res = lscandir_without_dot("__path_program_etc/.restart"); if ($res === false) { dprint(".restart does not exist... Creating\n"); lxfile_mkdir("__path_program_etc/.restart"); lxfile_generic_chown("__path_program_etc/.restart", "lxlabs"); } foreach ((array) $res as $r) { if (csb($r, "._restart_")) { $cmd = strfrom($r, "._restart_"); } lunlink("__path_program_etc/.restart/{$r}"); dprint("Restarting {$cmd}\n"); switch ($cmd) { case 'lxcollectquota': log_log("cron_exec", "Start collecting Quota's\n"); exec_justdb_collectquota(); break; case 'openvz_tc': log_log("cron_exec", "Start openvz_tc script\n"); exec_openvz_tc(); break; default: log_log("cron_exec", "Restarting {$cmd}\n"); exec_with_all_closed("/etc/init.d/{$cmd} restart"); break; } } }