ady has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use warnings; use Win32; my (@ccnet, $ccpid, $cwd); # --- Grep ccnet.exe pid @ccnet = split(/\n/,`C:\\systools\\\@SI\\PsTools\\pslist.exe`); @ccnet = grep(/ccnet/, @ccnet); $#ccnet and print "@ccnet\n"; ($ccpid) = "@ccnet" =~ /ccnet\s+(\d+)\s+/; # --- Kill ccnet.exe, if it exists if ( ! $ccpid ) { warn "NO ccnet\n"; } else { print "found ccnet (pid:$ccpid)\n"; kill('HUP', $ccpid); print "killed ccnet.exe (pid:$ccpid)\n"; sleep(3); } # --- Respawn ccnet.exe print "respawning ccnet.exe\n"; $ENV{SSDIR} = '\\Blr11e\kmd.sdpi.ews1'; $cwd = Win32::SetCwd("C:\\Program Files\\CruiseControl.NET\\server" +) || die "$!"; exec("start ccnet.exe") or print "couldn't exec ccnet: $!";
# Run ResetCCN.pl (exec overlay, - don't wait for new ccnet!) sub respawn_CCNet { print "<hr><h4>Restarting CCNet, -- please WAIT</h4><pre>"; system("perl ResetCCN.pl"); sleep(10); print "</pre><br>DONE!<hr>"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI and spawning a process with UI (Win32)
by shmem (Chancellor) on Apr 14, 2007 at 19:00 UTC | |
by ady (Deacon) on Apr 14, 2007 at 19:42 UTC | |
by shmem (Chancellor) on Apr 14, 2007 at 19:46 UTC | |
by ady (Deacon) on Apr 14, 2007 at 20:02 UTC | |
|
Re: CGI and spawning a process with UI (Win32)
by cdarke (Prior) on Apr 15, 2007 at 14:05 UTC | |
by ady (Deacon) on Apr 16, 2007 at 05:24 UTC |