| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Dear linuxmanagers, Let me first thank all who gave me a reply. Edward C. Bailey Andre Hopner Bob Ramsey David Cantrell Mark Street Martin Maney Mohit_Muthanna lbarnes@san.rr.com Brian Wilson sysadmin@astro.su.se D. Stimits Manuel Amador Every one had the same opinion. The applications that are running should be intelligent enough to handle the SIGTERM, SIGKILL interrupts. So the result is entirely dependent on the applications that are running. Now again howmany applications are capable of handling the SIGTERM and SIGKILL interrupts. I think I will have to do a research on this. All that we can do is issue the interrupt upon powerfailure; and that feature is available in-built. I was also aware that /etc/inittab handles the power failure signal. But I was thinking that I should be able to save the application's unsaved data after iterating through the open files (greedy idea). My idea is now get the list of applications that doesn't handle the signals properly (will vi or vim handle the kill signals, I think yes it creates swap files right). ----------------------------------------------------------------------- Now it is time to read what others say: I am not including all the replies since it will be a very large posting. ----------------------------------------------------------------------- Fri, 15 Feb 2002, Andre Hopner wrote: there are some events in /etc/inittab # what to do when power fails/returns pf::powerwait:/etc/init.d/powerfail start pn::powerfailnow:/etc/init.d/powerfail now #pn::powerfail:/etc/init.d/powerfail now po::powerokwait:/etc/init.d/powerfail stop # for ARGO UPS sh:12345:powerfail:/sbin/shutdown -h now THE POWER IS FAILING which this you can automate your script. but i don't know how to close all the opened files. ----------------------------------------------------------------------- Fri, 15 Feb 2002, Bob Ramsey wrote: Don't know if this would work, but you could do a ps to get all the running processes and then iterate through them, sending the appropriate save/exit commands. This could be a lot of work depending on the system because you could have a large number of users with a wide variety of programs, each program taking different commands. And not all of them may have an interface which let's you issue a save/exit from a script. But if you were more sure of the programs involved and what your users would be doing, this might work. ----------------------------------------------------------------------- 15 Feb 2002, Edward C. Bailey wrote That sounds like an interesting project! That depends on the application. The shutdown command causes various signals (TERM, and KILL, I think) to be sent to all processes. If your applications is written to perform a file save when it gets a TERM signal, there's nothing else you need to do. Well, lsof will give you a list of open files, but again, the application that has the file opened must have the "intelligence" to do the appropriate thing when given a signal. If the application doesn't have this "intelligence", there is little you can do (unless you are able to add this kind of feature to the application yourself)... There are programs that already exist that do this. Check with the company that made your UPS; many of them provide Linux programs now. There are also open source programs that work with different UPS systems; you can find them listed on www.freshmeat.net (do a search on "ups")... ----------------------------------------------------------------------- Fri, 15 Feb 2002, David Cantrell wrote: You will need to rewrite all your applications to be aware of your automated shutdown tool. With most such tools, they simply tell the OS to shutdown, and as part of its shutdown process it kills all running processes. It first tries a 'graceful' kill, and then if any processes ignored that, it kills them with extreme prejudice. Many - but not all - apps will Do The Right THing. Processes which run interactively generally won't do what you want in response to the graceful-kill signal. ------------------------------------------------------------------------ On Fri, 15 Feb 2002, Martin Maney wrote: Usually, you switch to runlevel 0 (man telinit), which sends signals to all processes; then they shut themselves down as cleanly as they have been programmed to do. If you have apps that fail to shut themselves down, that's an issue for the application developer to address. You may want to look at the NUT project (www.exploits.org/nut/), both for UPS monitoring software and, of course, discussions about managing the shutdown. ------------------------------------------------------------------------ Fri, 15 Feb 2002, D. Stimits wrote: I think this depends entirely on whether the application can be told to save and exit via an outside source. The typical means to do this would be to send a signal to all open applications that have the ability to save upon being signaled (this is a C type signal, see man signal). Typically done with a kill or killall command if done from command line. But the point there is that every application has to be written with that in mind, there is no general mechanism without the cooperation of whatever has the file opened. So the answer if you want a general catch-all save of anything opened by any application at all is that you probably cannot do it. If you have specific applications in mind, you probably need to state which applications you have that need to be told to save (and at that point maybe someone will know). ------------------------------------------------------------------------ Thanks and regards Sudheesh -- Sudheesh K Software Engineer Softjin Infotech Pvt. Ltd. No 227/70/A Sigma Arcade 1 Marathahalli Airport Road, Bangalore - 560037 Phone: 91-080-5234641/2 ext 206 Fax: 91-080-5234643 -------------------------------------------------------------------------------- This e-mail message and any files transmitted with it are intended solely for the use of the individual or entity to which they are addressed. It may contain confidential, proprietary or legally privileged information. If you are not the intended recipient please be advised that you have received this message in error and any use is strictly prohibited. Please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender by return mail. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. ------------------------------------------------------------------------------ _______________________________________________ LinuxManagers mailing list - http://www.linuxmanagers.org submissions: LinuxManagers@linuxmanagers.org subscribe/unsubscribe: http://www.linuxmanagers.org/mailman/listinfo/linuxmanagers
[Home] [Kernel List] [Linux SCSI] [Video 4 Linux] [Linux Admin] [Yosemite News] [Motherboards]