Shutdown C Program for Ubuntu Linux:
#include
int main() {
system("shutdown -P now");
return 0;
}
You need to be logged in as root user for above program to execute otherwise you will get the message shutdown: Need to be root, now specifies that you want to shutdown immediately. '-P' option specifes you want to power off your machine. You can specify minutes as:
shutdown -P "number of minutes"
For more help or options type at terminal: man shutdown.
No comments:
Post a Comment