]>
git.ipfire.org Git - people/stevee/ipfire-2.x.git/blob - src/misc-progs/ipfirereboot.c
2 * This file is part of the IPCop Firewall.
4 * IPCop is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * IPCop is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with IPCop; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Copyright (C) 2005-10-25 Franck Bourdonnec
20 * $Id: ipcopreboot.c,v 1.1.2.2 2005/10/24 23:05:50 franck78 Exp $
30 /* define operations */
31 #define OP_REBOOT "boot"
32 #define OP_REBOOT_FS "bootfs" // add filesystem check option (not yet in GUI)
33 #define OP_SHUTDOWN "down"
35 int main(int argc
, char**argv
)
41 // Check what command is asked
44 fprintf (stderr
, "Missing reboot command!\n");
48 if (argc
==2 && strcmp(argv
[1], OP_SHUTDOWN
)==0)
50 safe_system("/sbin/shutdown -h now");
54 if (argc
==2 && strcmp(argv
[1], OP_REBOOT
)==0)
56 safe_system("/sbin/shutdown -r now");
60 if (argc
==2 && strcmp(argv
[1], OP_REBOOT_FS
)==0)
62 safe_system("/sbin/shutdown -F -r now");
66 fprintf (stderr
, "Bad reboot command!\n");