[Kimchi-devel] [PATCH 1/2] add SysV init scripts in centos6

ssdxiao ssdxiao at 163.com
Thu Jun 19 10:43:24 UTC 2014


now in centos6 has'nt the SysV init scripts, so add it to kimchi

Signed-off-by: Ding Xiao <ssdxiao at 163.com>
---
 contrib/kimchid.sysvinit.centos6 |  112 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 112 insertions(+), 0 deletions(-)
 create mode 100644 contrib/kimchid.sysvinit.centos6

diff --git a/contrib/kimchid.sysvinit.centos6 b/contrib/kimchid.sysvinit.centos6
new file mode 100644
index 0000000..ba4adff
--- /dev/null
+++ b/contrib/kimchid.sysvinit.centos6
@@ -0,0 +1,112 @@
+#! /bin/sh
+#
+#kimchid               Kimchi Web Server
+#
+#
+# Author: Ding Xiao <ssdxiao at 163.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+#
+### BEGIN INIT INFO
+# Provides: kimchid
+# Required-Start: libvirtd
+# Required-Stop:
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Description: Start the kimchid daemon
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+prog="kimchid"
+exec="/usr/bin/kimchid"
+pidfile="/var/run/kimchi.pid"
+
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+    [ -x $exec ] || exit 5
+    echo -n $"Starting $prog: "
+    daemon --user root --pidfile $pidfile "$exec &>/dev/null & echo \$! > $pidfile"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc -p $pidfile $prog
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    restart
+}
+
+force_reload() {
+    restart
+}
+
+rh_status() {
+    status -p $pidfile $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+exit $?
+
-- 
1.7.1





More information about the Kimchi-devel mailing list