File: elogind.init

package info (click to toggle)
elogind 241.3-1+debian1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,044 kB
  • sloc: ansic: 102,512; xml: 15,615; python: 481; sh: 260; makefile: 38; awk: 29; perl: 17
file content (97 lines) | stat: -rw-r--r-- 2,814 bytes parent folder | download | duplicates (2)
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
95
96
97
#! /bin/sh
### BEGIN INIT INFO
# Provides: elogind
# Required-Start: dbus $remote_fs $syslog
# Required-Stop: dbus $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6  
# Short-Description: start elogind at boot tim
# Description: Enable user and session management by elogind
### END INIT INFO

set -e

# /etc/init.d/elogind: start and stop the elogind session management daemon

ELOGIND=/lib/elogind/elogind

test -x $ELOGIND || exit 0

umask 022

. /lib/lsb/init-functions

ELOGIND_OPTS="-D"
ELOGIND_PID=/run/elogind.pid

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
    log_daemon_msg "Starting session management daemon" "elogind" || true
    if start-stop-daemon --start --quiet --oknodo --pidfile $ELOGIND_PID --exec $ELOGIND -- $ELOGIND_OPTS; then
        log_end_msg 0 || true
    else
        log_end_msg 1 || true
    fi
    ;;
  stop)
    log_daemon_msg "Stopping session management daemon" "elogind" || true
    if start-stop-daemon --stop --quiet --oknodo --pidfile $ELOGIND_PID; then
        log_end_msg 0 || true
    else
        log_end_msg 1 || true
    fi
    ;;
  reload)
    log_daemon_msg "Reloading session management daemon" "elogind" || true
    if  start-stop-daemon --stop --signal HUP --quiet --pidfile $ELOGIND_PID; then
            log_end_msg 0 || true
    else
            log_end_msg 1 || true
    fi
    ;;
  force-reload|restart)
    log_daemon_msg "Restarting session management daemon" "elogind" || true
    # Use SIGINT for graceful restart so that existing sessions are not lost.
    start-stop-daemon --stop --quiet --oknodo --signal INT --retry 30 --pidfile $ELOGIND_PID
    if start-stop-daemon --start --quiet --oknodo --pidfile $ELOGIND_PID --exec $ELOGIND -- $ELOGIND_OPTS; then
        log_end_msg 0 || true
    else
        log_end_msg 1 || true
    fi
    ;;
  try-restart)
    log_daemon_msg "Restarting session management daemon" "elogind" || true
    RET=0
    start-stop-daemon --stop --quiet --retry 30 --pidfile $ELOGIND_PID || RET="$?"
    case $RET in
        0)
        # old daemon stopped
        if start-stop-daemon --start --quiet --oknodo --pidfile $ELOGIND_PID --exec $ELOGIND -- $ELOGIND_OPTS; then
            log_end_msg 0 || true
        else
            log_end_msg 1 || true
        fi
        ;;
        1)
        # daemon not running
        log_progress_msg "(not running)" || true
        log_end_msg 0 || true
        ;;
        *)
        # failed to stop
        log_progress_msg "(failed to stop)" || true
        log_end_msg 1 || true
        ;;
    esac
    ;;
  status)
    status_of_proc -p $ELOGIND_PID $ELOGIND elogind && exit 0 || exit $?
    ;;
  *)
    log_action_msg "Usage: /etc/init.d/elogind {start|stop|reload|force-reload|restart|try-restart|status}" || true
    exit 1
esac

exit 0