iPXE discussion forum

Full Version: Keep track of last boot?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there any way to keep track of the last booted OS? I want to configure iPXE to launch menu.c32 (this is working) but I want it to have a timeout where it boots to the same option that was last used. In other words if I was in Windows and perform a reboot I want it to come back up to Windows. It it was Linux come back up as linux. I am very new to all of this so by all means explain things as to a child. Smile
The most obvious question is this: Where (and when) would you actually store that information?

And no, I don't think ipxe has this feature, but maybe a second-stage bootloader supports it...
(2011-10-24 08:49)robinsmidsrod Wrote: [ -> ]The most obvious question is this: Where (and when) would you actually store that information?

And no, I don't think ipxe has this feature, but maybe a second-stage bootloader supports it...

Would it be possible that the currently running OS sets a flag on the TFTP server that a script could then act on?
If you're using some HTTP script (like my pxe-dispatcher, see other thread on the forum) you can probably modify it to store some information in some kind of database or flat file and default to that boot script on the next boot. But you'll have to program it. I'm not aware of anything (open source) that does this out of the box.
(2011-10-24 13:27)dpuckett Wrote: [ -> ]Would it be possible that the currently running OS sets a flag on the TFTP server that a script could then act on?

Yes... using a TFTP Client... The built-in Windows TFTP client doesn't accept Batch Scripting commands (Unlike the Windows Client FTP -i option). But there are Freeware TFTP Clients that do:

WinAgents TFTP Client and SolarWinds both offer freeware TFTP Clients which will work on most any Windows Platform.

My recommendation is to not do this, however...TFTP, by it's very nature, is not particularly reliable (but such a method is very easy, I'll grant you).

I would recommend researching robinsmidsrod's pxe-dispatcher, and possibly creating a R/W section in there to "Poke" the Dispatcher whenever the OS comes us and initiates a boot-up action (Example: Machine Name, MAC Address, booted OS).
(2011-10-20 18:42)dpuckett Wrote: [ -> ]Is there any way to keep track of the last booted OS? I want to configure iPXE to launch menu.c32 (this is working) but I want it to have a timeout where it boots to the same option that was last used. In other words if I was in Windows and perform a reboot I want it to come back up to Windows. It it was Linux come back up as linux. I am very new to all of this so by all means explain things as to a child. Smile

I'm currently developing a little python script to do this, I'll give it here when it will be done. Smile
(2011-10-30 05:11)MultimediaMan Wrote: [ -> ]
(2011-10-24 13:27)dpuckett Wrote: [ -> ]Would it be possible that the currently running OS sets a flag on the TFTP server that a script could then act on?

I would recommend researching robinsmidsrod's pxe-dispatcher, and possibly creating a R/W section in there to "Poke" the Dispatcher whenever the OS comes us and initiates a boot-up action (Example: Machine Name, MAC Address, booted OS).

Yes, this is exactly what I want to do is 'poke' the server dealing out the menu to dynamically change it as needed.
(2011-10-20 18:42)dpuckett Wrote: [ -> ]Is there any way to keep track of the last booted OS? I want to configure iPXE to launch menu.c32 (this is working) but I want it to have a timeout where it boots to the same option that was last used. In other words if I was in Windows and perform a reboot I want it to come back up to Windows. It it was Linux come back up as linux. I am very new to all of this so by all means explain things as to a child. Smile

I would use the example on the ipxe website of a php handing out the configuration file, it is posible to send mac adress with your requist to the php and the php uses a database to keep track who booted in what.
Reference URL's