[Kimchi-devel] CentOS Init Script

Michael Sole michael.sole at soledevelopment.com
Thu Jul 2 15:03:29 UTC 2015


I created a very simple CentOS 6 compatible init script. Its a little
hacky but it does work. I know I am supposed to make a patch but perhaps
someone can evaluate and decide if you want to include it:

#!/bin/sh
#
# Name: Kimchi init script for CentOS 6
# Author: Michael Sole
# Email: michael.sole(at)soledevelopment.com
#
# Description: Very simple init script to start, stop and restart the
Kimchi control panel
#
# Usage: /etc/init.d/kimchid start|stop|restart

### BEGIN INIT INFO
# Provides: kimchid
# Required-Start: $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Default-Start:  2345
# Default-Stop: 90
# Short-Description: run kimchi daemon
# Description: Very simple init script to start, stop and restart the
Kimchi control panel
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

exec="/usr/bin/kimchid"
prog="kimchid"

lockfile=/var/lock/subsys/$prog

start() {
    if [ -f "$lockfile" ]
    then
        echo "Lock file found, is the daemon already running?"
        exit 5
    fi
    echo -n $"Starting $prog: "
    nohup $exec  > /dev/null 2>&1 &
    echo "OK"
    touch $lockfile
    return 0
}

stop() {
    echo -n $"Stopping $prog: "
    rm -f $lockfile
    ps aux | grep -ie $prog | awk '{print $2}' | xargs kill -9 > /dev/null
2>&1
    return 0
}

restart() {
    stop
    start
}

case "$1" in
    start)
        $1
        ;;
    stop)
        $1
        ;;
    restart)
        $1
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 2
esac
exit $?




More information about the Kimchi-devel mailing list