#!/bin/bash # Copyright (C) Wizardry and Steamworks. ## # Licensed to Wizardry and Steamworks under # the GPLv3 GNU License which can be found at: # http://www.gnu.org/licenses/gpl.html # # http://grimore.org/ios:launchd_and_mysql # function throttleBlock() { MYSQLD=`ps ax | grep '[m]ysqld' | grep 'libexec' | awk '{ print $1 }'` while [[ (( "$1" == "off" && "$MYSQLD" != "" )) || (( "$1" == "on" && "$MYSQLD" == "" )) ]]; do sleep 0.1 # don't mess with blocking sleeps MYSQLD=`ps ax | grep '[m]ysqld' | grep 'libexec' | awk '{ print $1 }'` done } SETTING=`plutil -key mysqlEnabled /var/mobile/Library/Preferences/org.grimore.mysql.plist` if [ $SETTING -eq 0 ]; then /usr/libexec/mysql/launcher stop throttleBlock off else /usr/libexec/mysql/launcher start throttleBlock on fi