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