-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathidled.init
52 lines (49 loc) · 945 Bytes
/
idled.init
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
#!/bin/sh
#
# idled daemon that terminates idle user sessions
#
# chkconfig: 345 95 05
#
# description: idled keeps an eye on every users session, and terminates \
# them when user has been idle or logged in for too long
#
# Source function library
. /etc/rc.d/init.d/functions
RETVAL=0
# See how we were called.
case "$1" in
start)
# Check if the service is already running?
if [ ! -f /var/lock/subsys/idled ]; then
msg_starting idled
daemon idled
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/idled
else
msg_already_running idled
fi
;;
stop)
# Stop daemons.
if [ -f /var/lock/subsys/idled ]; then
msg_stopping idled
killproc idled
rm -f /var/lock/subsys/idled >/dev/null 2>&1
else
msg_not_running idled
fi
;;
restart|force-reload)
$0 stop
$0 start
exit $?
;;
status)
status idled
exit $?
;;
*)
msg_usage "$0 {start|stop|restart|force-reload|status}"
exit 3
esac
exit $RETVAL