To clear the cache on all the web servers(we have 4), I log on to any one machine, clear its cache, ssh to another machine, clear cache etc;
Is there any way to write a script so that this operation can be performed in one script ?
In other words, the script automatically ssh's into the 2nd server, clears the cache and then logs on to 3rd server and so on.
The ssh is over a trusted network and I am using the same account on each of these boxes so I am not prompted for password when going from one machine to another.
I tried to write such a script but what happens is although it logs into the other machine, I see a prompt for the other machine and when I exit it, I am back to the original machine. The script then runs on the original machine.
The web cache is cleared only on specific instances like when it is brought out of rotation or when we apply a patch to our database or a new build etc.
Since I do not have any control over these times, I cannot put this in cron.
Expect can also do that, on a more controlled level (expect filters input/output and manipulates it/enters it). I've had quite a large amount of sucess with expect.
also, assuming that you have wget on the remote pcs, you could simply write a script that will wget a blank file (called run) on a ftp or http server somewhere. then, when you want to run the script, you could copy the file to the http/ftp server, and wait for the script to run, then delete the file from the ftp server. a bit mc guyver-ed, but gets the job done just the same.