AppleScript for starting and stopping Apache and MySQL
Got a couple of pieces of AppleScript for starting and stopping Apache and MySQL which are too small to be worth posting as snippets.
Starting:
do shell script "/sw/sbin/apachectl start" password "MY_PASSWORD" with administrator privileges
do shell script "/usr/local/mysql/bin/mysqld_safe > /dev/null 2>&1 &" password "MY_PASSWORD" with administrator privileges
Stopping:
do shell script "/sw/sbin/apachectl stop" password "MY_PASSWORD" with administrator privileges
do shell script "/usr/local/mysql/bin/mysqladmin -u root -pROOT_MYSQL_PASSWORD shutdown" password "MY_PASSWORD" with administrator privileges
You will obviously need to change MY_PASSWORD to your admin password. You need to change ROOT_MYSQL_PASSWORD to your root MySQL password, or another user name/password combo with shutdown privileges. Note: there should not be a space between -p and ROOT_MYSQL_PASSWORD.
Also, the path to apache/mysql might need changing. You can find out where they are by running which apachectl and which mysqld_safe in the terminal.
Just paste the code into Script Editor, and save how/wherever you like. I save mine as run-only executables which show up nicely in Quicksilver.

Comments
Add a comment
Your email address will not be shared, sold, or made visible on the site.