-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-service.sh
executable file
·45 lines (41 loc) · 1.31 KB
/
run-service.sh
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
#!/bin/bash
#
# This scripts run gitit as a service on a given data volume. If the wiki
# does not exist, it will initialize it with enhanced templates.
TMPL_PATH=/data/gitit-templates-enhanced
WIKI_PATH=/data/gitit-wiki
RUN_PATH=/data/gitit-run
GITIT_CFG="$WIKI_PATH/gitit.conf"
if [ ! -f "$GITIT_CFG" ]; then
echo "Initializing gitit.conf"
cp "$TMPL_PATH/sample.gitit.conf" "$GITIT_CFG"
mkdir -p "$WIKI_PATH/logs"
if [ ! -d "$WIKI_PATH/templates" ]; then
echo "Initializing wiki templates"
cp -rf "$TMPL_PATH/templates" "$WIKI_PATH"
fi
if [ ! -d "$WIKI_PATH/static" ]; then
echo "Initializing wiki static files"
cp -rf "$TMPL_PATH/static" "$WIKI_PATH"
fi
if [ ! -d "$WIKI_PATH/wikidata" ]; then
echo "Initializing wikidata"
cp -rf "$TMPL_PATH/wikidata" "$WIKI_PATH"
pushd "$WIKI_PATH/wikidata" >/dev/null
git init .
git config user.name "gitit"
git config user.email "[email protected]"
git add .
git commit -m "Initialize wiki with help pages"
popd >/dev/null
fi
fi
SUPERVISORD_CFG="$RUN_PATH/supervisord.conf"
if [ ! -f "$SUPERVISORD_CFG" ]; then
echo "Initializing supervisord.conf"
cp "$TMPL_PATH/sample.supervisord.conf" "$SUPERVISORD_CFG"
fi
pushd "$RUN_PATH" >/dev/null
echo "Running supervisord as ${USER}($UID)"
supervisord -c "$SUPERVISORD_CFG"
popd >/dev/null