owensct Posted September 27, 2010 Share Posted September 27, 2010 Hi All, New to AutoIt and I am in the middle of writing a script to shutdown a database engine and then perform a backup of the database and restart the engine. The script is supposed to check to see if the process is running and if it is then kill it. The problem I've run into is that I can't figure out how to check the status of the process on the remote computer. I know I can use ProcessExists() on the local machine, but is there a way or equivalent to obtain the process status on a remote system? Rough steps to process are as follows: If process is running then Kill process Backup database Restart database engine Wait 10 seconds Verify that engine has started Message Box “backup completed successfully” Exit Else Message box Database is down please contact IS department Exit Any help would be greatly appreciated Thanks Gordon Link to comment Share on other sites More sharing options...
Varian Posted September 28, 2010 Share Posted September 28, 2010 (edited) Search the web for psexec & pskill...look here for AutoIT references. Edited September 28, 2010 by Varian Link to comment Share on other sites More sharing options...
owensct Posted September 28, 2010 Author Share Posted September 28, 2010 Search the web for psexec & pskill...look here for AutoIT references.Thanks Varian,I did finally figure it out. Here is the snippet of code I used in case anyone else has a similar question.Case $BtnQ2 ; Starts daily backup process$answer = MsgBox(4, "Daily Backup", "Have all users signed off the One Staff system?")If $answer = 7 thenMsgBox(0," DataBase Backup", "Please ensure all users are logged off the System before continuing")Else$pid = Run('sc \\RemoteServer query "ServiceName"', '', @SW_HIDE, 2) ; Uses the Microsoft sc functionDo$data &= StdOutRead($pid)Until @errorIf StringInStr($Data, 'running') thenRunWait('sc \\Servername stop "Pervasive.SQL (relational)"', '', @SW_HIDE, 2) ; if the service in question is running then stop itRunWait('sc \\Servername stop "Pervasive.SQL (transactional)"', '', @SW_HIDE, 2) ;in my case I have two servicesd that need to be stopped;Backup process goes hereRunWait('sc \\rhp-vms-001 start "Pervasive.SQL (relational)"', '', @SW_HIDE, 2) ;Restarts the service on the remote serverRunWait('sc \\rhp-vms-001 start "Pervasive.SQL (transactional)"', '', @SW_HIDE, 2) ;Restarts second serviceElseMsgBox(0,"One Staff Backup", "Database engine is down please contact the IS Department")ExitEndIfCheers,Gordon Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now