Context Navigation


InitdScriptForLinux: centos_init_script

File centos_init_script, 1.8 KB (added by MaZaY, 14 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
15 DAEMON_DIR=/project/path
16
17 # Source function library.
18 ./etc/rc.d/init.d/functions
19
20 if![-x$DAEMON_DIR/manage.py];then
21 echo"ERROR: $DAEMON_DIR/manage.py not found"
22 exit0
23 fi
24
25
26
27 # Full path to daemon
28 PYTHON=/python/path
29 PROG=manage.py
30 DAEMON=$DAEMON_DIR/$PROG
31 DAEMONARGS='runfcgi method=threaded host=127.0.0.1 port=3033 pidfile=/profect/path/run/forum.pid &> /dev/null'
32 PIDFILE=/project/path/run/forum.pid
33
34
35 # Allow configuration overrides in /etc/sysconfig/django_fcgi
36 CONFIG0=`readlink0ドル`
37 if["$CONFIG0"=""];then
38 CONFIGFILE=/etc/sysconfig/`basename0ドル`
39 else
40 CONFIGFILE=/etc/sysconfig/`basename$CONFIG0`
41 fi
42 [-x$CONFIGFILE]&&.$CONFIGFILE
43
44 RETVAL=0
45
46 start(){
47
48 ifstatus$PROG>/dev/null;then
49 status$PROG
50 exit1
51 fi
52
53 # Start daemons.
54 echo-n$"Starting django_fcgi: "
55 daemon$PYTHON$DAEMON$DAEMONARGS
56
57 RETVAL=$?
58 [$RETVAL-eq0]&&touch/var/lock/subsys/$PROG
59 echo
60 return$RETVAL
61 }
62
63 stop(){
64 # Stop daemons.
65 echo-n$"Shutting down django_fcgi: "
66 PID=$(cat$PIDFILE)
67 kill-9$PID
68 RETVAL=$?
69 [$RETVAL-eq0]&&rm-f/var/lock/subsys/$PROG
70 echo
71 return$RETVAL
72 }
73
74 restart(){
75 stop
76 start
77 }
78
79
80 # See how we were called.
81 case"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 statusdjango_fcgi
96 ;;
97 *)
98 echo"Usage: django_fcgi {start|stop|restart|reload|condrestart|status}"
99 exit1
100 esac
101
102 exit$?
Back to Top