Opened 12 years ago

Last modified 12 years ago

#35183 new enhancement

mysql51, mysql55, percona, mariadb: Simple stop/start applescript

Reported by: ctreleaven (Craig Treleaven) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.1
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), pixilla (Bradley Giesbrecht), zquestz (Josh Ellithorpe), jogwtr@…
Port: mysql51, mysql55, percona, mariadb

Description

Attached is an Applescript that simplifies the process of starting and stopping the mysql server. Screen capture at:

https://dl.dropbox.com/u/26787680/StopStartMySQL.png

It displays whether MySQL server is running/not running and, correspondingly offers to Stop/Start the daemon. It only stops the server IF launchd reports that it is running "mysql5". If the user also has installed MySQL from a .dmg (non-MacPorts), we leave it alone and display an error message.

To add this to the mysql5-server install, as an Applescript applet, put the scpt in Files and add a line (probably to post-destroot) such as:

system "osacompile -x -o ${destroot}${applications_dir}/somedir/MySQL_Stop_Start.app ${filespath}/MySQL_Stop_Start.scpt"

Attachments (2)

MySQL Stop Start.scpt (7.9 KB) - added by ctreleaven (Craig Treleaven) 12 years ago.
MySQL_Stop_Start.applescript (1.7 KB) - added by ctreleaven (Craig Treleaven) 12 years ago.
plain text

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by ctreleaven (Craig Treleaven)

Attachment: MySQL Stop Start.scpt added

comment:1 Changed 12 years ago by neverpanic (Clemens Lang)

The mysql5-server port already installs a startup item that can conveniently be started using sudo port load mysql5-server and stopped with sudo port unload mysql5-server. Does this script provide any benefit over this?

comment:2 Changed 12 years ago by ctreleaven (Craig Treleaven)

Advantages:

1) It displays whether or not the server is running. I suspect I'm not the only one that has forgotten that a background process is already running! ;)

2) Point and click rather than remember and type.

Similar to the System Preferences panel that the official .dmg installs:

https://dl.dropbox.com/u/26787680/MySQLPrefPanel.png

comment:3 Changed 12 years ago by pixilla (Bradley Giesbrecht)

Your attached .scpt file has Myth functionality. Perhaps you attached the wrong file.

Let's save these types of AppleScript files as text files so they are more easily read by humans, they can still be compiled with osacomile.

comment:4 Changed 12 years ago by ctreleaven (Craig Treleaven)

Hmm, plain text version now attached--s/b MySQL control, only.

Changed 12 years ago by ctreleaven (Craig Treleaven)

plain text

comment:5 Changed 12 years ago by ctreleaven (Craig Treleaven)

Viewed online, AppleScript's line breaks (Option-Return) show a question mark symbol. Let me know if that causes any harm when downloaded.

comment:6 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: quest@… jogwtr@… added
Port: mysql51 mysql55 percona mariadb added; mysql5-server removed
Summary: mysql5-server: Simple stop/start applescriptmysql51, mysql55, percona, mariadb: Simple stop/start applescript

mysql5-server is going away. If these changes are to be incorporated, it would be into the mysql51 / mysql55 / percona / mariadb ports.

However, this problem is hardly unique to the MySQL ports. Any port that installs a launchd plist could be said to benefit from such a script. Why not make it generic, so that it can control any launchd plist, and make it a separate port?

Perhaps you even want to simply use one of the existing launchd management programs that exist, such as lingon.

Note: See TracTickets for help on using tickets.