-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathast
40 lines (33 loc) · 781 Bytes
/
ast
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
#!/bin/sh
# Load init functions
. /lib/lsb/init-functions
MONGREL_RAILS=/usr/bin/mongrel_rails
AST_HOME=/home/example/ast/current
AST_USER=nobody
MONGREL_CONF=$AST_HOME/config/mongrel_cluster.yml
SUDO_USER='su - ${AST_USER} -c'
case "$1" in
start|stop|restart)
echo -n "Starting AST: "
# solr index
$SUDO_USER "cd $AST_HOME; /usr/bin/rake solr:$1 RAILS_ENV=production 2>/dev/null"
# mongrel
$MONGREL_RAILS cluster::$1 -C $MONGREL_CONF
STATUS=$?
if [ "$STATUS" -eq 0 ]
then
log_success_msg "ast"
else
log_failure_msg "ast"
fi
exit $STATUS
;;
status)
# Since we are always OK, always return OK as status
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0