LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-26-2006, 12:21 AM   #1
sedan258
LQ Newbie
 
Registered: Sep 2006
Posts: 5

Rep: Reputation: 0
what is the library function for shutting down linux?


I am writing a program in linux that shuts down the system as if executing "shutdown -h now" under the shell. I wonder which library function (in C) I shall use for that. Thanks.
 
Old 09-26-2006, 12:49 AM   #2
pankaj99
Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 47

Rep: Reputation: 15
try
system("shutdown -h now");

I have never tried it myself though.
 
Old 09-26-2006, 03:47 AM   #3
scoban
Member
 
Registered: Nov 2004
Location: Turkey
Distribution: Slackware
Posts: 145

Rep: Reputation: 16
To see which libraries is being used:

Code:
ldd /sbin/shutdown
 
Old 09-27-2006, 11:53 AM   #4
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
man shutdown says:
Quote:
shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
list library function of a shared library .so powah Linux - General 7 10-25-2011 04:47 AM
gets library function in C reddazz Programming 3 03-27-2005 02:04 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 09:18 PM
Library function to search for files on Linux vtluu Red Hat 3 04-16-2004 01:31 PM
C# using DotGNU, how do I use a library function? exodist Programming 3 02-22-2004 09:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration