Dave Korn wrote on Wednesday, September 10, 2008 7:22 PM:: > Rob wrote on 10 September 2008 19:03: > >> Since I'll be doing this upgrade on close to 100 boxes, >> I've been trying to devise a *relatively* unattended process. >> In case it helps anyone in the future, here's a snippet of my cmd >> script I have so far: >> >> echo off >> echo This will kill all cygwin related processes and update cygwin >> echo Hit CTRL-C now to abort, otherwise: >> pause >> c:\cygwin\bin\bash.exe --login -c "ps -la|sed 's/^I/ /'|awk '{print >> $4}'|grep - v WINPID >/tmp/pids.txt" >> for /F %i in (c:\cygwin\tmp\pids.txt) DO taskkill /PID %i /F >> del /F c:\cygwin\tmp\pids.txt >> echo running setup... >> \\fileserver\cygwin\setup-2.602.exe -q -L -l \\fileserver\cygwin -R >> C:\cygwin echo Done > > That seems like a good start, but it's perhaps just a little bit > crude in the way it handles services; if you kill them stone dead > like that, the SCM will try and restart any that are set for > auto-restart-on-fail. It would probably be a minor improvement if > you add an extra bit of bash to shut them down gracefully by invoking > cygrunsrv on them, something a bit like ... > > c:\cygwin\bin\bash.exe --login -c "cygrunsrv -L | xargs -n 1 > cygrunsrv -E" > > ... and only then carry on to brute-force kill the leftovers. >
I don't know if this will work, but if you've around 100 boxes to upgrade, it's probably worth investigating. Instead of upgrading with the possibility of in use files, then rebooting to fix any problems, why not attack it the other way round? Install your script as a RunOnce task in the registry, then reboot. The reboot will ensure there are no in use files, the script will invoke setup (I think) before any services or normal startup tasks, so you should be confident that setup will complete successfully, and not require a second reboot. Obviously, this will cause some unnecessary reboots, but this is Windowsland where rebooting is a way of life; even Windows' programmers never expected uptime to exceed 2^32 milliseconds. Regarding the "setup not running postinstall scripts if there are any in-use files" suggestion, could I suggest that this idea be modified slightly? Postponing all scripts could leave the system (prior to reboot) with a package which was successfully installed, but not postinstalled, and therefore potentially unusable when it could have been completely installed. All that is necessary is to ensure that the packages' dependencies are honoured when running their postinstall scripts. This would ensure that as much as possible of the installation could be completed prior to rebooting. e.g. if package A depends on packages B and C, but a file from package B is in use, package C can be completely installed and postinstalled, but package A can only be installed. Running its postinstall script must be delayed until after package B's postinstall script has run following a reboot. Phil -- This email has been scanned by Ascribe PLC using Microsoft Antigen for Exchange. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/