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. |
Quote:
You can also use command to reboot: Code:
/sbin/shutdown -r now Code:
/sbin/shutdown -h now |
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 |
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. |
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>. |
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.
|
All times are GMT -5. The time now is 02:17 AM. |