-
Notifications
You must be signed in to change notification settings - Fork 5
/
andes-helpd
executable file
·83 lines (74 loc) · 1.88 KB
/
andes-helpd
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
#!/bin/bash
#
# andes-helpd Startup script for Andes Help Server
#
# chkconfig: - 75 10
# description: Andes help server
# processname: andes-helpd
# Source function library.
. /etc/rc.d/init.d/functions
SBCL=/usr/local/bin/sbcl
SBCL_OPTIONS="--dynamic-space-size 1000"
# Values for these are set during the install process:
LUSER=<--LUSER-->
ANDES_SERVER_DIR=<--SERVER_DIR-->
RETVAL=0
# need user name and init file from configuration!
ANDES_INIT=" < ${ANDES_SERVER_DIR}/init.cl >& ${ANDES_SERVER_DIR}/init.log &"
prog=${SBCL-sbcl}
LOCK=/var/lock/subsys/andes-helpd
# This might be used for Bug #1721
#pidfile=/var/run/andes-helpd.pid
# Test the user has an sbcl init file.
#[ `su - ${LUSER} -c ls ~/.sbclrc` ] || exit 1
#
# In principle, we could save the sbcl core file on shutdown and
# restart using that. This would allow user sessions to survive
# a restart and allow for faster restarts.
# However, we would still have to restart the help server inside lisp
# (restart hunchentoot and reconnect to the database).
#
start() {
echo -n $"Starting $prog: "
# --pidfile=${pidfile} might be used for Bug #1721
# The OLI version of daemon does not have the --pidfile flag.
daemon --user ${LUSER} $prog $SBCL_OPTIONS $ANDES_INIT
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch $LOCK
return $RETVAL
}
# When stopping, need a delay to allow help server to shut down
# all sessions.
stop() {
echo -n $"Stopping $prog: "
(telnet localhost 6440 &) > /dev/null 2>&1
sleep 6
# killproc -d 5 $prog
echo "Can't kill any hung server, Bug #1721"
RETVAL=0
echo
rm -f $LOCK
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
# status -p ${pidfile} $prog
echo "Can't determine status, Bug #1721"
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|stop|restart}"
exit 1
esac
exit $RETVAL