Added "safe mode" option selection

This commit is contained in:
bergware
2020-04-09 11:56:37 +02:00
parent 0bf743af1c
commit 19de45242a
2 changed files with 4 additions and 1 deletions

View File

@@ -546,7 +546,7 @@ function formatWarning(val) {
<form name="shutdownOps" method="POST" action="/webGui/include/Boot.php">
<table markdown="1" class="array_status noshift">
<tr><td></td><td><input type="button" name="reboot" value="_(Reboot)_" onclick="shutdown_now(this.form,'reboot')"><input type="button" name="shutdown" value="_(Shutdown)_" onclick="shutdown_now(this.form,'shutdown')"></td>
<td>**_(Reboot)_** _(will activate a *clean* system reset)_.<br>**_(Shutdown)_** _(will activate a *clean* system power down)_.</td></tr>
<td>**_(Reboot)_** _(will activate a *clean* system reset)_.<br>**_(Shutdown)_** _(will activate a *clean* system power down)_.<br><input type="checkbox" name="safemode"><small>_(Reboot in safe mode)_</small></td></tr>
<tr><td></td><td class="line" colspan="2"></td></tr>
</table>
</form>

View File

@@ -75,12 +75,15 @@ $(document).ajaxSend(function(elm, xhr, s){
</script>
</head>
<?
$safemode = '/boot/unraidsafemode';
switch ($_POST['cmd']) {
case 'reboot':
if (isset($_POST['safemode'])) touch($safemode); else @unlink($safemode);
exec('/sbin/reboot');?>
<body onload="reboot_online()"><div class='notice'></div></body>
<? break;
case 'shutdown':
if (isset($_POST['safemode'])) touch($safemode); else @unlink($safemode);
exec('/sbin/poweroff');?>
<body onload="shutdown_online()"><div class='notice'></div></body>
<? break;