Hello Experts, We are having a server Dell R710 and it has windows server 2008 as Operating system. Now every time we reboot it stucks are 'Press F1 key to continue, F2 to run the system setup program' Due to this we are having some outage as will not come. BIOS update on Dell PowerEdge R710. Blog Monday, August 27, 2012. BIOS update on Dell PowerEdge R710 BIOS update on Dell PowerEdge R710. Restart the system for the update to take effect. The update remains incomplete until the system is rebooted. Would you like to reboot your system now?
Need to save the script state before reboot and then on resume, i need to start the script from the point it was left.
Mine is a Windows 2k12 System on a Dell R710 Server.What I have done so far is:1. Pickled the step number before which I need to reboot the machine. pickle.dump( self.boot_flag, open( 'c:data.pkl', 'wb'))2. i give a 'os.system('shutdown -r -t 0 -f')'My question now is, show to pass the step number that i have saved, so that my script resumes from there?
1 Answer
You have a series of problems :
- Saving state (including curent execution points),
- detecting shutdown/reboot,
- restarting after shutdown.
I would suggest that actually your are best off ignoring the middle issue, and ensure that your application keeps a minimal amount of internal state - i.e. store all of your data in an external database etc.
Edit : Make sure that you can save your state in small atomic chunks. An application I have written uses a transactional based relational database, and saves state in a set of three tables) - I also have a system which can detect errors after the fact. The advantage of a database is that it has it's own recover mechanism in case of failures.
If you think about what you need to restart, then you can ensure that when your application restarts it is almost exactly the same state. About the only thing you wont be able to do is restart execution at exactly the same line of code, but actually it may be that that is not the issue, and the issue is maintaining continuity of functionality (i.e. apart from timestamps you can't detect an interruption).
Edit : As an example my application reads the database every time it starts up, looking for records not marked as complete - in this way it can resume the functionality, at almost any point.
Restarting is pretty simple, write your code so it can run as a service.
Edit : The worst case actually isn't a restart/rebot - in these cases all the running processes are asked to shutdown nicely - and you can trap that signal and do something at least (so long as it is quick). The worst case is a power off/crash (due to overheat for instance), then you get no warning and have zero chance of a clean shutdown. In designing your application you need to consider what is the worse thing that can happen.