| 1 | #!/bin/sh
|
|---|
| 2 | # Start/stop/restart mythbackend
|
|---|
| 3 | #
|
|---|
| 4 | # Modification done by Benoit Beauchamp, based on rc.mysqld by
|
|---|
| 5 | #
|
|---|
| 6 | # Copyright 2003 Patrick J. Volkerding, Concord, CA
|
|---|
| 7 | # Copyright 2003 Slackware Linux, Inc., Concord, CA
|
|---|
| 8 | #
|
|---|
| 9 | # This program comes with NO WARRANTY, to the extent permitted by law.
|
|---|
| 10 | # You may redistribute copies of this program under the terms of the
|
|---|
| 11 | # GNU General Public License.
|
|---|
| 12 | #
|
|---|
| 13 |
|
|---|
| 14 | # Start mythbackend:
|
|---|
| 15 | myth_start() {
|
|---|
| 16 | if [ -x /usr/bin/mythbackend ]; then
|
|---|
| 17 | # If there is an old PID file (no mysqld running), clean it up:
|
|---|
| 18 | if [ -r /var/run/mythbackend.pid ]; then
|
|---|
| 19 | if ! ps axc | grep mythbackend 1> /dev/null 2> /dev/null ; then
|
|---|
| 20 | echo "Cleaning up old /var/run/mysql/mysql.pid."
|
|---|
| 21 | rm -f /var/run/mythbackend.pid
|
|---|
| 22 | fi
|
|---|
| 23 | fi
|
|---|
| 24 | /usr/bin/mythbackend -l /var/log/mythbackend.log -v important,general -p /var/run/mythbackend.pid -d
|
|---|
| 25 | fi
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | # Stop mythbackend:
|
|---|
| 29 | myth_stop() {
|
|---|
| 30 | # If there is no PID file, ignore this request...
|
|---|
| 31 | if [ -r /var/run/mythbackend.pid ]; then
|
|---|
| 32 | killall mythbackend
|
|---|
| 33 | # Wait at least one minute for it to exit, as we don't know how big the DB is...
|
|---|
| 34 | fi
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | # Restart mysqld:
|
|---|
| 38 | myth_restart() {
|
|---|
| 39 | myth_stop
|
|---|
| 40 | myth_start
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | case "$1" in
|
|---|
| 44 | 'start')
|
|---|
| 45 | myth_start
|
|---|
| 46 | ;;
|
|---|
| 47 | 'stop')
|
|---|
| 48 | myth_stop
|
|---|
| 49 | ;;
|
|---|
| 50 | 'restart')
|
|---|
| 51 | myth_restart
|
|---|
| 52 | ;;
|
|---|
| 53 | *)
|
|---|
| 54 | echo "usage $0 start|stop|restart"
|
|---|
| 55 | esac
|
|---|