/* * ================================================================= * Filename: m_serviceboot.c / Unreal3.2 * Description: Command /service * Starts IRCServices without SSH access - Only NetAdmins * Kodlayan: Raistlin * Version: Unreal3.2 * ================================================================= */ #include "config.h" #include "struct.h" #include "common.h" #include "sys.h" #include "numeric.h" #include "msg.h" #include "channel.h" #include #include #include #include #include #ifdef _WIN32 #include #endif #include #include "h.h" #ifdef STRIPBADWORDS #include "badwords.h" #endif #ifdef _WIN32 #include "version.h" #endif int servisgetir(aClient *); #define MSG_SERVIS "SERVICE" #define TOK_SERVIS '\0' ModuleHeader MOD_HEADER(servisac) = { "serviceboot", "ircservices NetAdmins Only", "Command: /service - Author: Raistlin - Starts IRCServices without SSH access", "3.2-b8-1", NULL }; DLLFUNC int MOD_INIT(servisac)(ModuleInfo *modinfo) { add_Command(MSG_SERVIS, TOK_SERVIS, servisgetir, 1); return MOD_SUCCESS; } DLLFUNC int MOD_LOAD(servisac)(int module_load) { return MOD_SUCCESS; } DLLFUNC int MOD_UNLOAD(servisac)(int module_unload) { return MOD_SUCCESS; } int servisgetir(aClient *sptr) { if (!IsNetAdmin(sptr)) { sendnotice(sptr, "*** Permission Denied: /SERVICE command is restricted to Network Administrators only."); return 0; } if (system("pgrep -x ircservices > /dev/null") == 0) { sendnotice(sptr, "*** [Status] IRCServices is already running. Action aborted."); } else { sendnotice(sptr, "*** [Shell] IRCServices is not running. Starting now..."); system("cd && cd ircservices && ./ircservices"); sendnotice(sptr, "*** [Success] IRCServices boot signal sent."); } return 0; }