noosfero
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Sample init.d script for noosfero.
#
# This script was based on the skeleton init.d script present in a Debian
# GNU/Linux system (sid), on Sat Feb 16 11:12:03 BRT 2008. It must be placed in
# /etc/init.d/ (or whatever place your system uses for startup scripts), and you must create a file /etc/default/noosfero defining the variable
#
# Author: Antonio Terceiro <terceiro@colivre.coop.br>
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Noosfero web platform"
NAME=noosfero
SCRIPTNAME=/etc/init.d/$NAME
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
if [ -z $NOOSFERO_DIR ] || [ -z $NOOSFERO_USER ]; then
echo "NOOSFERO_DIR or NOOSFERO_USER not defined, noosfero not being started."
echo "Both variables must be defined in /etc/default/noosfero"
exit 0
fi
######################
FERRET_PID_FILE=$NOOSFERO_DIR/log/ferret.pid
main_script() {
cd $NOOSFERO_DIR
if [ "$NOOSFERO_USER" != "$USER" ]; then
su $NOOSFERO_USER -c "./script/production $1"
else
./script/production $1
fi
}
do_start() {
# FIXME should not test for ferret only
if [ -e $FERRET_PID_FILE ]; then
echo 'noosfero already running, cannot start.'
exit 2
fi
main_script start
}
do_stop() {
# FIXME should not test for ferret only
if [ ! -e $FERRET_PID_FILE ]; then
echo 'noosfero not running, cannot stop'
exit 2
fi
main_script stop
}
do_restart() {
do_stop
do_start
}
case "$1" in
start|stop|restart)
do_$1
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac
: