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"
21 void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
24 ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
25 if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
27 ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
29 argv[0] = ServerInstance->Config->MyExecutable;
31 if (ServerInstance->Config->nofork)
41 // close ALL file descriptors
42 ServerInstance->SendError("Server restarting.");
44 for (int i = 0; i < MAX_DESCRIPTORS; i++)
51 execv(ServerInstance->Config->MyExecutable,argv);
57 ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);