I'm looking for a way to be sure it is not already running on some other machine before starting it.
The best way I've figured out is to check for an existing .pid in the MySQL folder.
The easiest thing would be to modify the shortcut but I don't think that's possible afaik.
So I need to do a couple of things.
- figure out where MySQL is stored
- check for the existence of a .pid file and if found the file throw an error stating so with the name of the file MINUS the extension to give them a hint what machine is be running it.
- if not exist then go ahead and start wamp like it normally would with the shortcut.
DONE.
If necessary we can ask the user ONCE where wamp is stored then it's simply at %wamp%\bin\mysql I tried this script but it doesn't do it properly, it's opening 2 cmd windows and just throwing a pause. Thanks Bear
@echo off
cd "C:\google_drive\server\wamp64"
forfiles /p bin\mysql\ /m *.pid /s /c "cmd /c goto error"
start wampmanager.exe
exit
:error
echo I'm sorry, Mysql is already running so I can't start WAMP for you. Shutdown WAMP on @FNAME before running again."
pause