We have an ASP script for updating web content which deploys a whole bunch of files from one server to another on the click of a button. Here are the steps it takes - pretty simple:
1. Delete all files requiring an update from Server B (remote server)
2. Copy all new files from Server A (local) to Server B
The problem is that many of these files are ASP scripts themselves and if someone is browsing the 'live' website on Server B (remote) then IIS will have the current scripts locked. So our delete script runs but gets to a file locked by IIS and fails, having deleted half the site, and does not continue with copying over the new version of the site. Very messy! I have to Remote Access to the server, wait for a gap in usage and manually delete the offending scripts before running the 'Deploy' functionality again.
So, I need to be able to check if a file is locked and ignore it in the process (perhaps reporting on that later) or be able to over-write locked files regardless.
I'm wondering if anyone's seen any examples of this app being run from an ASP script? (Insecure, I know, but the box it would run on is DEEP in the network at my company so it can't be accessed externally - of that I'm sure.)
Or failing that, has anyone seen a routine that would do this instead:
1. Cycle through all files requiring an update on Server B (remote server)
- if locked, skip file
- if not locked, delete
2. Cycle through all new files on Server A (local) copying to Server B by
- if exists, don't copy
- if doesn't exist, copy
Obviously step 2 is easy - step 1, the checking for locked files, is the bit I'm wondering about. Can't seem to find anything in Google.