Dharanyadevi blogspot subsume with E-books, Notes, Lab Manual, Question Banks, Interview Tips, Viva Questions, Basics and Interview Questions for engineering students. For Any Help Contact dharanyadevi@gmail.com

SEARCH

Image

Monday, April 23, 2012

Shutdown Program for Ubuntu Linux in C

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

Refer this site 2 ur frndz