-
-
Notifications
You must be signed in to change notification settings - Fork 124
/
solr-init-Debian-pre5.j2
94 lines (81 loc) · 2.13 KB
/
solr-init-Debian-pre5.j2
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
91
92
93
94
#!/bin/sh
# chkconfig: 2345 95 05
# description: Controls an Apache Solr process.
#
# This script will launch Solr in a mode that will automatically respawn if it
# crashes. Output will be sent to $LOG_FILE. A PID file will be created in the
# standard location.
#
# Adapted by Jeff Geerling from http://stackoverflow.com/a/8014720/100134
### BEGIN INIT INFO
# Provides: {{ solr_service_name }}
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Apache Solr search server
### END INIT INFO
SOLR_DIR="{{ solr_install_path }}/example"
JAVA_OPTIONS="-Dsolr.solr.home={{ solr_home }} -Djetty.host={{ solr_host }} -Djetty.port={{ solr_port }} -Xms{{ solr_xms }} -Xmx{{ solr_xmx }}"
START_COMMAND="java -jar $JAVA_OPTIONS start.jar"
LOG_FILE="{{ solr_log_file_path }}"
start () {
echo -n "Starting {{ solr_service_name }}... "
daemon -U --chdir="$SOLR_DIR" --command "$START_COMMAND" --respawn --output=$LOG_FILE --name={{ solr_service_name }}
RETVAL=$?
if [ $RETVAL = 0 ]
then
echo "done."
else
echo "failed. See error code for more information."
fi
return $RETVAL
}
stop () {
echo -n "Stopping {{ solr_service_name }}... "
daemon --stop --name={{ solr_service_name }}
RETVAL=$?
if [ $RETVAL = 0 ]
then
echo "done."
else
echo "failed. See error code for more information."
fi
return $RETVAL
}
restart () {
echo -n "Restarting solr... "
daemon --restart --name={{ solr_service_name }}
RETVAL=$?
if [ $RETVAL = 0 ]
then
echo "done."
else
echo "failed. See error code for more information."
fi
return $RETVAL
}
check_status () {
# Report on the status of the daemon
daemon --running --name={{ solr_service_name }} --verbose
return $?
}
case "$1" in
start)
start
;;
status)
check_status
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: solr {start|status|stop|restart}"
exit 3
;;
esac
exit $RETVAL