This problem happen quite frequently while uploading a .war or .ear, that are just little more than .zip file, to a remote server, and have it deployed by the application server.
Usually, at development stage, an application server is on 'hot deploy', which means that the application server itself is listening for change on a specific directory, if it recognize that a valid application file (.ear or .war) has been dropped in it, then it is unpacked and deployed as java application.
It happens that while the upload is in progress, and this is usually done with tools like ant or maven directly from the development environment, the application server start deploy, to discover later than it is a corrupted zip file because the upload wasn't finished yet.
The workaround I found is to upload to an external directory, then connect to ssh and mv the file to the 'hot deploy' location.
Do you have any suggestion on how to deal with this ? I am not a system administrator, but what I would like to have is a kind of shell script (maybe run under cron) that listen to a directory and when an upload is incoming (via scp), wait until it is finished then do a mv to the server directory.
What variables do I have to take into account for building this script ?