LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-29-2007, 11:43 PM   #1
fanoliv
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15
reboot command


Hello all. When I type "reboot" at the command prompt in the terminal, does it run some kind of batch file or does it run an executable? Where is this executable located?

Actually, what I'm really interested in is to know what port Linux is writing to to perform the reboot. For example, I know you can write to port 92h, 64h, or cf9h, to do the reboot. I'd like to know which of these linux uses, and if it's possible to change it so that it's using a different port from what it currently uses. For example, if it's using 92h, but I'd like it to use 64h instead, would it be possible to do this?

Thank you.
 
Old 04-29-2007, 11:56 PM   #2
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Quote:
Where is this executable
Probably /sbin
You can also use command to reboot:
Code:
/sbin/shutdown -r now
Or to shutdown:
Code:
/sbin/shutdown -h now
 
Old 04-30-2007, 12:41 AM   #3
skulbite
LQ Newbie
 
Registered: Apr 2005
Location: Barbados
Distribution: Mandrake/Mandriva
Posts: 15

Rep: Reputation: 0
At first I thought reboot was an alias to 'shutdown -r now', but I have found, in Mandriva, reboot is located:

/sbin/reboot
/usr/bin/reboot
 
Old 04-30-2007, 01:16 AM   #4
fanoliv
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
So I guess in this case reboot is an actual executable program, then? Even so, would it still be possible for me to write my own program to replace this reboot so that it uses the port I want it to use? The programming part of it is probably not too difficult. Pretty much it's just something like "outportb (0x64, 0xfe)" or something like that.

Let's say I write this short program in C and compile it. Is there anything else I have to do other than replace the old reboot with my new one? Or would this require some messing with the kernel or something before I can use my new executable?

Thank you.
 
Old 04-30-2007, 01:32 AM   #5
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
Reboot is run level 6, so:

Init 6 essentially does:

Reboot

and changes the run level to 6.

If your looking for files, try udatedb as root, and then locate <file>.
 
Old 04-30-2007, 06:15 PM   #6
fanoliv
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Thank you. I've also found out that the the reboot is using some system services that's supposed to put the system in the right state before rebooting. So I guess I can't just write a small program like I wanted to do to replace the old reboot.
 
  


Reply

Tags
reboot, shutdown


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reboot command at selected O.S. raven4d Linux - Software 2 03-20-2006 06:15 AM
reboot when "reboot" command not responding? neocookie Linux - General 1 08-30-2005 05:59 AM
rename reboot command coco03 Linux - General 6 04-19-2005 03:11 AM
problem with reboot command Belkorin Fedora 0 07-09-2004 11:59 AM
command to reboot linux klintonray Linux - Software 2 08-25-2003 07:10 PM


All times are GMT -5. The time now is 10:56 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration