-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc.Linux
45 lines (38 loc) · 829 Bytes
/
rc.Linux
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/sh
#
### BEGIN INIT INFO
# Provides: launchd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the launchd(8) daemon at boot time
# Description: Enable the launchd(8) service manager.
### END INIT INFO
# TODO: use LSB, if this is still a thing?
PATH=/sbin:/usr/sbin:/bin:/usr/bin
PIDFILE=/var/run/launchd.pid
case $1 in
start)
printf "Starting launchd.. "
if [ -f $PIDFILE ] ; then
echo 'already running'
exit 1
else
launchctl load /etc/launchd/daemons /usr/share/launchd/daemons
fi
;;
stop)
printf "Stopping launchd.. "
kill `cat $PIDFILE`
rm -f $PIDFILE
;;
restart)
$0 stop && sleep 3 && $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 2
;;
esac
exit 0