Add ability for filesystem check and restart network through GUI
Message ID | CAM7c+bm_o8mzOKRYLYZb9gr5A+xzPDLfHqcd+ZRU2ScTjdCLRQ@mail.gmail.com |
---|---|
State | Dropped |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.tremer.info [172.28.1.200]) by septima.ipfire.org (Postfix) with ESMTP id 054316137A for <patchwork@ipfire.org>; Thu, 20 Aug 2015 15:54:27 +0200 (CEST) Received: from hedwig.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id B91553273; Thu, 20 Aug 2015 15:54:27 +0200 (CEST) Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c05::230; helo=mail-ig0-x230.google.com; envelope-from=mibs510@gmail.com; receiver=development@lists.ipfire.org Received: from mail-ig0-x230.google.com (mail-ig0-x230.google.com [IPv6:2607:f8b0:4001:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPS id 17A0821AD for <development@lists.ipfire.org>; Thu, 20 Aug 2015 15:54:25 +0200 (CEST) Received: by igbjg10 with SMTP id jg10so129053915igb.0 for <development@lists.ipfire.org>; Thu, 20 Aug 2015 06:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nKv4Psvf55Xdv8lByYbu8Mlww5lUsYLzd8P83bN9sQc=; b=gEYY08izu/sN7lPL+RStYyMNl9S90nKaxWjccIHwT4ZtKBevCMXMc2dwknclGulYdj LTOsF69GlIrt67c2Raq70bNv3Y30PjfOydW2Zshb06NYvi2Axs69zxsMv0nCCwJ+XEpp ++01o5huycEx5eIebcCtapx4uRX7vX34oCWQU3ssoWBmS5vd7SsdLWDVgSeUM48kAOLO dsFScU3+nK6KdOZQGfEGKSpLZDUQYzzbXmRwcoiyxNh8vzoUNj2tIIYJ3KiL0yx6B7PA xehMxSYl/ROEad9XBoZk76ZAvo/ecWmMkHlrMGfyy54RZ9Eo2G2Ksg/rygBbWdqki5S6 EcUw== MIME-Version: 1.0 X-Received: by 10.50.66.197 with SMTP id h5mr7368999igt.81.1440078862979; Thu, 20 Aug 2015 06:54:22 -0700 (PDT) Received: by 10.107.181.209 with HTTP; Thu, 20 Aug 2015 06:54:22 -0700 (PDT) Date: Thu, 20 Aug 2015 06:54:22 -0700 Message-ID: <CAM7c+bm_o8mzOKRYLYZb9gr5A+xzPDLfHqcd+ZRU2ScTjdCLRQ@mail.gmail.com> Subject: [PATCH] Add ability for filesystem check and restart network through GUI From: Osmar Gonzalez <mibs510@gmail.com> To: development@lists.ipfire.org Content-Type: multipart/alternative; boundary=047d7bd6be0e139723051dbe7de7 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <http://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <http://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Message
Osmar Gonzalez
Aug. 20, 2015, 11:54 p.m. UTC
Just on the side note I added the function of restarting the network stack through the GUI only because I find useful at times when the DNS might be stall or when in DHCP mode the IP address wasn't renewed, simply restarting the network stack helps in fixing minor problems here in there without the need to login through SSH or CLI to restart #define OP_SCHEDULE_REM "cron-" @@ -66,6 +67,13 @@ int main(int argc, char**argv) return 0; } + if (argc==2 && strcmp(argv[1], OP_REBOOT_NETWORK)==0) + { + safe_system("/etc/rc.d/init.d/network stop"); + safe_system("/etc/rc.d/init.d/network start"); + return 0; + } + // output schedule to stdout if (argc==2 && strcmp(argv[1], OP_SCHEDULE_GET)==0) {
Comments
Hi, thank you for submitting this patch. On Thu, 2015-08-20 at 06:54 -0700, Osmar Gonzalez wrote: > Just on the side note I added the function of restarting the network > stack through the GUI only because I find useful at times when the > DNS might be stall or when in DHCP mode the IP address wasn't > renewed, simply restarting the network stack helps in fixing minor > problems here in there without the need to login through SSH or CLI > to restart I think that this should rather not happen and if so we should look for fixing any issues that are causing this, but I have no objections to the change if you need it. What is the reason for the FS check? The system should perform them when ever needed. Other than that there is really no reason to why the user should trigger that. Best, -Michael > diff --git a/html/cgi-bin/shutdown.cgi b/html/cgi-bin/shutdown.cgi > index 998f9f8..fa66962 100644 > --- a/html/cgi-bin/shutdown.cgi > +++ b/html/cgi-bin/shutdown.cgi > @@ -34,6 +34,13 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) > { > $rebirth = 1; > &General::log($Lang::tr{'rebooting ipfire'}); > system '/usr/local/bin/ipfirereboot boot'; > +} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot_net'}) { > + &General::log($Lang::tr{'rebooting network'}); > + system '/usr/local/bin/ipfirereboot network &> /dev/null'; > +} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot_fs'}) { > + $rebirth = 1; > + &General::log($Lang::tr{'rebooting fs'}); > + system '/usr/local/bin/ipfirereboot bootfs'; > } > if ($death == 0 && $rebirth == 0) { > > @@ -51,6 +58,12 @@ if ($death == 0 && $rebirth == 0) { > <td width='50%' align='center'><input type='submit' > name='ACTION' value='$Lang::tr{'shutdown'}' /></td> > </tr> > </table> > +<table width='100%'> > +<tr> > + <td width='50%' align='center'><input type='submit' > name='ACTION' value='$Lang::tr{'reboot_net'}' /></td> > + <td width='50%' align='center'><input type='submit' > name='ACTION' value='$Lang::tr{'reboot_fs'}' /></td> > +</tr> > +</table> > END > ; > &Header::closebox(); > @@ -85,4 +98,3 @@ END > > &Header::closebigbox(); > &Header::closepage(); > - > diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl > index af7fda9..a2ba697 100644 > --- a/langs/en/cgi-bin/en.pl > +++ b/langs/en/cgi-bin/en.pl > @@ -1917,8 +1917,12 @@ > 'reboot question' => 'Extra query for restart and shutdown', > 'reboot schedule' => 'Schedule IPFire reboots', > 'reboot sure' => 'Are you sure that you want to reboot?', > +'reboot_fs' => 'File Systemcheck', This is spelled "Filesystem check". A verb would also help, like "Perform a filesystem check". > +'reboot_net' => 'Reboot Network', This should better be called "Restart network" because the system is not rebooted. > 'rebooting' => 'Rebooting', > +'rebooting fs' => 'Rebooting with filesystem check.', > 'rebooting ipfire' => 'Rebooting IPFire', > +'rebooting network' => 'Rebooting Network', > 'reconnect' => 'Reconnect', > 'reconnection' => 'Reconnection', > 'red' => 'Internet', > diff --git a/src/misc-progs/ipfirereboot.c b/src/misc > -progs/ipfirereboot.c > index 5e75879..5f11ba3 100644 > --- a/src/misc-progs/ipfirereboot.c > +++ b/src/misc-progs/ipfirereboot.c > @@ -29,7 +29,8 @@ > > /* define operations */ > #define OP_REBOOT "boot" > -#define OP_REBOOT_FS "bootfs" // add filesystem check > option (not yet in GUI) > +#define OP_REBOOT_FS "bootfs" > +#define OP_REBOOT_NETWORK "network" > #define OP_SHUTDOWN "down" > #define OP_SCHEDULE_ADD "cron+" > #define OP_SCHEDULE_REM "cron-" > @@ -66,6 +67,13 @@ int main(int argc, char**argv) > return 0; > } > > + if (argc==2 && strcmp(argv[1], OP_REBOOT_NETWORK)==0) > + { > + safe_system("/etc/rc.d/init.d/network stop"); > + safe_system("/etc/rc.d/init.d/network start"); > + return 0; > + } > + > // output schedule to stdout > if (argc==2 && strcmp(argv[1], OP_SCHEDULE_GET)==0) > { >