Tirumudi
Tirumudi

Reputation: 443

'ShutDown' or 'Reboot' linux system using MONO C#?

I'm developing an application to run on LINUX using MONO C#. I need to do shutdown and reboot the system on Linux. In windows we can do it easily by calling 'shutdown.exe' from Process.Start() method. I like to know how to do the same on Linux. Thanks in advance....

Upvotes: 2

Views: 2473

Answers (1)

sloth
sloth

Reputation: 101142

There are several ways. Some possible commands you can invoke via Process.Start():

  • halt
  • poweroff
  • reboot
  • shutdown

Have a look here or several other websites or read the manuals of the commands for more information.

Take into account that your application/the user that runs it propably has not the necessary rights to reboot/shutdown the machine, and that the commands may not be in your PATH.

Upvotes: 2

Related Questions