How to reboot a Linux machine - the easy way

Hi Guys,
though I would share

dim myshell as new Shell
dim s as string

if TargetLinux then
mySHELL.mode = 2
Label1.text = “sudo reboot”
mySHELL.Execute “sudo reboot”

while InStr ( s, "pass")=0
  s= myshell.Result
  Label1.text = s

mySHELL.WriteLine ROOTpassword

MsgBox myshell.Result

end if

delay is a window with a timer in it set for 1 second (1000 milliseconds), when it fires it closes itself ( delay.close )

ROOTpassword is already defined and is the password of the logged in user.

I couldn’t get it to with with root but I stopped once this worked.
If you can improved please feel free to share

PS - tried app.pausecurrentthread(1000) but it doesn’t work.


Pulling the plug is also pretty effective :wink:

That’s not a reboot and doesn’t give a result back in the shell. :wink:


if brick = NIL then
try keyboard out window

if fail then
select case greg

Not tested, but try this:

dim myshell as new Shell
if TargetLinux then
    mySHELL.mode = 0
    Label1.text = "sudo reboot"
    mySHELL.Execute "echo "+ROOTpassword+" | sudo -S shutdown -r now"
end if

Hi Rick,


works like a charm for everything I need (so far)

echo damon | sudo -S service vsftpd stop

the service stops - brilliant

echo damon | sudo -S service vsftpd start

the service starts- brilliant - no password prompt - time to start re-coding.

Many thanks