InitdScriptForLinux: centos_init_script

File centos_init_script, 1.8 KB (added by MaZaY, 13 years ago)

In CentOS this file shoul look like this

Line 
1#!/bin/sh
2# $Id: rc.redhat.Django_FCGI 226811 2009-11-02 17:14:20Z tilghman $
3#
4# django_fcgid Starts, Stops and Reloads Django_FCGI.
5#
6# chkconfig: 2345 92 64
7# description: django_fcgi daemon start-stop script
8# processname: django_fcgi
9# pidfile: /opt/pure_ftpd_webui_forum/run/forum.pid
10#
11# We Sep 22 2010
12# Version 1.0
13
14# Installation directory
15DAEMON_DIR=/project/path
16
17# Source function library.
18. /etc/rc.d/init.d/functions
19
20if ! [ -x $DAEMON_DIR/manage.py ] ; then
21 echo "ERROR: $DAEMON_DIR/manage.py not found"
22 exit 0
23fi
24
25
26
27# Full path to daemon
28PYTHON=/python/path
29PROG=manage.py
30DAEMON=$DAEMON_DIR/$PROG
31DAEMONARGS='runfcgi method=threaded host=127.0.0.1 port=3033 pidfile=/profect/path/run/forum.pid &> /dev/null'
32PIDFILE=/project/path/run/forum.pid
33
34
35# Allow configuration overrides in /etc/sysconfig/django_fcgi
36CONFIG0=`readlink $0`
37if [ "$CONFIG0" = "" ]; then
38 CONFIGFILE=/etc/sysconfig/`basename $0`
39else
40 CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
41fi
42[ -x $CONFIGFILE ] && . $CONFIGFILE
43
44RETVAL=0
45
46start() {
47
48 if status $PROG > /dev/null; then
49 status $PROG
50 exit 1
51 fi
52
53 # Start daemons.
54 echo -n $"Starting django_fcgi: "
55 daemon $PYTHON $DAEMON $DAEMONARGS
56
57 RETVAL=$?
58 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROG
59 echo
60 return $RETVAL
61}
62
63stop() {
64 # Stop daemons.
65 echo -n $"Shutting down django_fcgi: "
66 PID=$(cat $PIDFILE)
67 kill -9 $PID
68 RETVAL=$?
69 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
70 echo
71 return $RETVAL
72}
73
74restart() {
75 stop
76 start
77}
78
79
80# See how we were called.
81case "$1" in
82 start)
83 start
84 ;;
85 stop)
86 stop
87 ;;
88 restart)
89 restart
90 ;;
91 condrestart)
92 [ -f /var/lock/subsys/$PROG ] && restart || :
93 ;;
94 status)
95 status django_fcgi
96 ;;
97 *)
98 echo "Usage: django_fcgi {start|stop|restart|reload|condrestart|status}"
99 exit 1
100esac
101
102exit $?
Back to Top