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
Showing posts with label Shutdown Program for Ubuntu Linux in C. Show all posts
Showing posts with label Shutdown Program for Ubuntu Linux in C. Show all posts

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.

Refer this site 2 ur frndz