On Wed, May 27, 2009 at 10:52 AM, Iustin Pop <[email protected]> wrote: > On Wed, May 27, 2009 at 10:42:34AM +0100, Guido Trotter wrote: >> On Wed, May 27, 2009 at 10:40 AM, Iustin Pop <[email protected]> wrote: >> > On Wed, May 27, 2009 at 10:14:53AM +0100, Guido Trotter wrote: >> >> On Tue, May 26, 2009 at 6:45 PM, Iustin Pop <[email protected]> wrote: >> >> > + >> >> > + �...@classmethod >> >> > + def LinuxPowercycle(cls): >> >> > + """Linux-specific powercycle method. >> >> > + >> >> > + """ >> >> > + fd = os.open("/proc/sysrq-trigger", os.O_WRONLY) >> >> >> >> Should we check that it exists before actually opening it? >> >> Or catch an error in the os.open call. We can at least try to log the >> >> error. >> > >> > So I expect here that opening will fail, and the normal handler will log >> > it. >> > >> > But good point, we can make it more explicit. I'd propose: >> > - try to open >> > - if fail: >> > - run “telinit 6”? or shutdown -r? >> > >> >> sure, this works! (no particular preference from me between those two...) > > Even though it's deprecated, "shutdown -r -n now" seems the fastest way > to reboot. Or, alternatively, a small C wrapper over the ‘reboot()’ > function could be used.
Is that different than using /sbin/reboot ? Should we use that, if it exists, and shutdown -r now failing that? If we can avoid having to ship a C wrapper it's probably for the best! :) Guido
