1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "configreader.h"
19 #include "commands/cmd_restart.h"
23 extern "C" command_t* init_command(InspIRCd* Instance)
25 return new cmd_restart(Instance);
28 CmdResult cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
31 ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
32 if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
34 ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
36 argv[0] = ServerInstance->Config->MyExecutable;
38 if (ServerInstance->Config->nofork)
48 // close ALL file descriptors
49 ServerInstance->SendError("Server restarting.");
51 for (int i = 0; i < MAX_DESCRIPTORS; i++)
58 execv(ServerInstance->Config->MyExecutable,argv);
64 ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);