Remove Shutdown Buttons from VPS

There is a reason it's the best Betfair trading software, there is so much it can do!
Post Reply
sa7med
Posts: 800
Joined: Thu May 18, 2017 8:01 am

I find myself stressing slightly about accidentally shutting down my VPS every time I want to restart manually. I need to restart manually because there is no set time where the VPS can be automatically restarted as they may be running some automations. Thought i'd share my solution in case it's of any use to anyone.

What i did was turn off the shutdown/restart/sleep/hibernate buttons via gpedit.msc /user configuration/administrative templates/start menu and taskbar - double click remove and prevent shutdown, restart,sleep and change the setting to 'enabled'

Then create a batch file on your desktop with the line: shutdown.exe /r /t 00

if you want to be prompted with an "Are you sure?" you can do the following:
@ECHO OFF

:choice
set /P c=Are you sure you want to restart[Y/N]?
if /I "%c%" EQU "Y" goto :somewhere
if /I "%c%" EQU "N" goto :somewhere_else
goto :choice


:somewhere

shutdown.exe /r /t 00
pause
exit

:somewhere_else

exit
User avatar
Euler
Posts: 24701
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

I hadn't thought of setting up a batch file to reboot. Nice tip!
User avatar
ShaunWhite
Posts: 9731
Joined: Sat Sep 03, 2016 3:42 am

Removing user access to reboots is common practice so you've stumbled upon the correct way to do things sa7med. Give them a batch that says they want one, and it gets done when it's safe to do so.

I schedule a daily reboot after my archive tasks have run and it uses a batch to ensure other processes have completed. The only issue with a scheduled reboot is that if you don't log on again before your next scheduled task executes, it can't pop up a window to run in, so just runs in the backgound and you don't get any display. If that's a problem you can always tick the 'Run only when user is logged on' in the security settings in Task Scheduler. If I'm not going to be able to log in for some reason I just disable my reboot task, which isn't really that necessary anyway and stay logged on 247.
JoshuaMuse
Posts: 2
Joined: Sat Apr 06, 2019 9:27 am

sa7med wrote:
Fri Oct 25, 2019 8:00 am
I find myself stressing slightly about accidentally shutting down my VPS every time I want to restart manually. I need to restart manually because there is no set time where the VPS can be automatically restarted as they may be running some automations. Thought i'd share my solution in case it's of any use to anyone. Check out my latest reviews on eatrbox.com - toodrie.com - ginnero.com

What i did was turn off the shutdown/restart/sleep/hibernate buttons via gpedit.msc /user configuration/administrative templates/start menu and taskbar - double click remove and prevent shutdown, restart,sleep and change the setting to 'enabled'

Then create a batch file on your desktop with the line: shutdown.exe /r /t 00

if you want to be prompted with an "Are you sure?" you can do the following:
@ECHO OFF

:choice
set /P c=Are you sure you want to restart[Y/N]?
if /I "%c%" EQU "Y" goto :somewhere
if /I "%c%" EQU "N" goto :somewhere_else
goto :choice


:somewhere

shutdown.exe /r /t 00
pause
exit

:somewhere_else

exit
I did not know that this feature is available. Nice tip!
sa7med
Posts: 800
Joined: Thu May 18, 2017 8:01 am

JoshuaMuse wrote:
Thu Jan 02, 2020 10:07 am
I did not know that this feature is available. Nice tip!
Cheers! I actually improved the batch slightly so you don't have to hit return. Just Y or N. Code below.

Code: Select all

@echo off
choice /c yn /n /m "Do you want to restart [y] or [n] ?"

if %errorlevel% == 1 shutdown.exe /r /t 00
if %errorlevel% == 2 exit

pause >nul
Post Reply

Return to “Bet Angel - Tips and tricks”