[Xitami] RE: Stopping and restarting (or resetting) Xitamiwithperl

MRJ InfoTech Admin admin at mrjdesign.net
Sun Jan 8 02:34:53 CET 2006


>- either your CGI either goes directly and reboots the PC if on Win, and
>   Xitami is killed/can start up auto after reboot,
>
>- or the perl CGI would say something like:

The CGI would reboot the system using the following windows API
'This works in VB 5 and 6, havn't tried 4 but should work if you have an 
old compiler.

'In general section
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, 
ByVal dwReserved As Long) As Long

Sub Main()
     'reboot the computer
     ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
End Sub



>   exec( halting_and_starting_executable() );

I wouldn't know cause I don't do Perl at all.


>   and the exec'ed process would not self-destroy after Xitami halt
>   when Xitami kills all executing CGI's because an exec'ed process is
>not
>   a process dependent on the lifespan of the launcher of itself?

Of course it's killed.
It kills the server even in this case but you could just as well create an 
application that will initiate a set order of actions by an ini file or 
registry entries after rebooting again to do what you want it to do...

Say for instance according to the following scheme...


1) save params desired to a ini file
2) Execute the reboot by force, make sure your app is in the startup list 
for HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
3) On run , read the saved params in the ini file and do what you want it 
to do...
4) Restart the Xitami by using WindowsProc or ShellExec API for instance...

It's all fairly basic stuff once you get used to it.
I am sure you can do it the open source way too and even use VBScript or 
JScript on your server can to do it.

I just find Perl to "un-readable" to deal with myself and I prefer to stick 
with the VB way of controlling my machines
It's also fairly simple to re-write and alter shoul dyou want to add or 
change something later on.

Then again, to all their favourite flavor I guess (^^)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.imatix.org/pipermail/xitami/attachments/20060108/f5364872/attachment.html


More information about the Xitami mailing list