function channelBotStart($service_id) { global $config; //get the identifier $id = stripAlphaNumeric(getServiceParam($service_id, "id")); if ($id === false) { return "Error: failed to find identifier. Perhaps this isn't a channel service?"; } //check if the bot is already started $pid = getServiceParam($service_id, "pid"); if ($pid !== false && $pid != 0) { return "Error: the bot is already online."; } //make sure we didn't start too recently to prevent Battle.net flooding $last_time = getServiceParam($service_id, "start_time2"); if ($last_time !== false && $last_time != 0 && time() - $last_time < 900) { return "Error: please wait ten minutes between starting or restarting the bot."; } //start the bot $jail = jailEnabled($service_id); if ($jail) { $pid = jailExecuteBackground($service_id, "cd " . escapeshellarg(jailPath($service_id)) . " && nohup ./chop++ chop.cfg > /dev/null 2>&1 & echo \$!"); } else { $pid = execBackground("cd " . escapeshellarg($config['channel_path'] . $id) . " && nohup ./chop++ chop.cfg > /dev/null 2>&1 & echo \$!"); } //save the pid and last start time setServiceParam($service_id, "pid", $pid); setServiceParam($service_id, "start_time2", getServiceParam($service_id, "start_time")); setServiceParam($service_id, "start_time", time()); return true; }
function minecraftStart($service_id) { global $config; //get the identifier $id = stripAlphaNumeric(getServiceParam($service_id, "id")); if ($id === false) { return "Error: failed to find identifier. Perhaps this isn't a minecraft service?"; } //check if the bot is already started $pid = getServiceParam($service_id, "pid"); if ($pid !== false && $pid != 0) { return "Error: the server is already online."; } //make sure we didn't start too recently to prevent Battle.net flooding //** eh... maybe remove this because... it's minecraft server? :P $last_time = getServiceParam($service_id, "start_time2"); //start the bot $jail = jailEnabled($service_id); $memoryLimit = minecraftMemoryLimit($service_id); if ($jail) { $pid = jailExecuteBackground($service_id, "cd " . escapeshellarg(jailPath($service_id)) . " && nohup java -jar -Xmx{$memoryLimit}M minecraft.jar > /dev/null 2>&1 & echo \$!"); } else { $pid = execBackground("cd " . escapeshellarg($config['minecraft_path'] . $id) . " && nohup java -jar -Xmx{$memoryLimit}M minecraft.jar > /dev/null 2>&1 & echo \$!"); } //save the pid and last start time setServiceParam($service_id, "pid", $pid); setServiceParam($service_id, "start_time2", getServiceParam($service_id, "start_time")); setServiceParam($service_id, "start_time", time()); return true; }
function garenaStart($service_id) { global $config; //get the identifier $id = stripAlphaNumeric(getServiceParam($service_id, "id")); if ($id === false) { return "Error: failed to find identifier. Perhaps this isn't a Garena service?"; } //check if gcb is already started $pid = getServiceParam($service_id, "pid"); if ($pid !== false && $pid != 0) { return "Error: the Garena connection software is already online."; } //start gcb $jail = jailEnabled($service_id); if ($jail) { $pid = jailExecuteBackground($service_id, "cd " . escapeshellarg(jailPath($service_id)) . " && nohup java -jar -Xmx90m gcb.jar > /dev/null 2>&1 & echo \$!"); } else { $pid = execBackground("cd " . escapeshellarg($config['garena_path'] . $id) . " && nohup java -jar -Xmx90m gcb.jar 2>&1 >> " . escapeshellarg($config['garena_path'] . $id . "/gcb.log") . " & echo \$!"); } //save the pid and last start time setServiceParam($service_id, "pid", $pid); return true; }