1

I have 2 machines running linux.

In one machine, the reboot command is an executable normally found in all linux distributions.

In the second machine the reboot command is a shell script customized using some other hardware tool commands to reboot the system.

One behavior difference between the two machines is that when I execute the reboot command on the first machine, it shows another shell prompt and then reboots.

But in the case of second machine, it reboots without showing a shell prompt. I expect the second machine to behave the same way as first machine when reboot command is given.

Currently I am analyzing the source code of shutdown.c and halt.c normally found in linux distributions, so that I can find out the implementation which produces the shell propmt on reboot and use that in the shell script in second machine.

Kindly give me some pointers on where I should start looking to find the implementation.

Thanks

5
  • We will need more details of the second machine's Linux distribution and version.
    – trojanfoe
    Jan 11, 2011 at 9:26
  • The second machine's Linux distribution is WindRiver Linux 2.6.27.3. The shell script uses ipmi commands to reboot the system. Jan 11, 2011 at 9:28
  • ipmi looks very interesting - I'd never heard of it before. Can I ask why you require the behaviour to be the same? Are you processing the output of the reboot commands in some way (some sort of automated systems management)?
    – trojanfoe
    Jan 11, 2011 at 9:38
  • I am afraid, i wont be able to give anymore info on ipmi as part of my project. I require the same behavior because the customer wants it that way in both machines running his same application. I am not processing the output of reboot commands in any way. I just use the ipmi command to reboot the system. I am analyzing the source code of shutdown and halt so that it could be implemented in the shell script as well. Could u give me some pointers if u are familiar with the source code of those? Jan 11, 2011 at 9:48
  • I'm surprised this got migrated from SO, it is a coding question primarily.
    – Orbling
    Jan 11, 2011 at 22:06

4 Answers 4

1

Use shutdown -r instead. It's historically been used throughout various unices, so I believe its interface and behavior are more commonly known and predictable.

2
  • Thanks. But i am allowed to use only the ipmi command to reboot the system. Jan 11, 2011 at 9:35
  • Have you tried? Maybe shutdown will internally use this utility somehow.
    – ulidtko
    Jan 11, 2011 at 9:45
1

My guess is that the program double forks itself into the background.

1

I expect that the program which returns you to the prompt is not actually doing anything itself, but rather communicating with your init daemon (sysvinit or upstart or whatever is running as process 1) and asking it to shut down the system. The other script is just a normal script.

0

The Linux kernel is what issues the final syscalls to reboot the machine, not the userland. Likely, the kernel internally uses IPMI to reboot the machine. Systems have different approaches to powering down and rebooting. I've run across a few that require you to kick a pin on the RTC in order to reboot the system, and that's exactly what the kernel does for that machine.

What's the machine's architecture? ARM, MIPS, other? WindRiver is the developer behind VxWorks if I am not mistaken. You can probably call their support people and see if they can assist you as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .