#!/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: $!";