Ignore:
Timestamp:
2011-11-16T10:44:18+01:00 (5 years ago)
Author:
nico
Message:

packages/mysql: use new service functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • packages/libs/mysql/files/mysqld.init

    r25243 r29176  
    11#!/bin/sh /etc/rc.common 
    2 # Copyright (C) 2010 OpenWrt.org 
     2# Copyright (C) 2010-2011 OpenWrt.org 
    33 
    44START=95 
    55STOP=10 
    66 
    7 PID=/var/run/mysqld.pid 
    8 CMD=/usr/bin/mysqld 
     7SERVICE_DAEMONIZE=1 
     8SERVICE_WRITE_PID=1 
     9SERVICE_STOP_TIME=9 
     10 
     11error() { 
     12        echo "${initscript}:" "$@" 1>&2 
     13} 
    914 
    1015start() { 
    1116        local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf) 
    1217        if [ ! -d "$datadir" ]; then 
    13                 echo "Error: datadir in /etc/my.cnf ($datadir) doesn't exist" 
     18                error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist" 
    1419                return 1 
    15         elif [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then 
    16                 echo "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables" 
     20        fi 
     21        if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then 
     22                error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables" 
    1723                return 1 
    18         else 
    19                 echo -n "Starting MySQL daemon... " 
    20                 start-stop-daemon -x $CMD -b -S -- --pid-file=$PID 
    21                 echo "done" 
    2224        fi 
     25        service_start /usr/bin/mysqld 
    2326} 
    2427 
    2528stop() { 
    26         echo -n "Stopping MySQL daemon... " 
    27         service_kill ${CMD##*/} $PID 
    28         echo "done" 
     29        service_stop /usr/bin/mysqld 
    2930} 
Note: See TracChangeset for help on using the changeset viewer.