File: openscap-daemon.oscapd.init

package info (click to toggle)
openscap-daemon 0.1.10-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,616 kB
  • sloc: xml: 86,526; python: 5,874; sh: 247; makefile: 23
file content (62 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download
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
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides:          oscapd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Daemon for infrastructure-level SCAP compliance check
# Description:       This service is a daemon that allow periodic compliance
#                    scans of a complete infrastructure, supporting local
#                    check, remote check, VM or Docker check.
#                    The daemon is associated to a CLI allowing easy
#                    configuration of targets and  security profiles to
#                    evaluate and easy results and reports management
### END INIT INFO

set -e

# Author: Philippe Thierry <phil@reseau-libre.net>

. /lib/lsb/init-functions



DESC="oscapd"
DAEMON=/usr/bin/oscapd
PIDFILE=/var/run/oscapd.pid

# This is an example to start a single forking daemon capable of writing
# a pid file. To get other behaviors, implement do_start(), do_stop() or
# other functions to override the defaults in /lib/init/init-d-script.
# See also init-d-script(5)

do_start() {
  # oscapd doesn't go into background and does not support pidfile
  # it can be checked as a dbus service but it is easier to check
  # its status through a pidfile in the case of sysvinit start
  if [ ! -f $PIDFILE ]; then
    log_daemon_msg "Starting OpenSCAP dbus service" "oscapd" || true
    if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --make-pidfile --background --exec $DAEMON; then
      log_end_msg 0 || true
    else
      log_end_msg 1 || true
    fi
  else
    log_daemon_msg "OpenSCAP dbus service already started" "oscapd" || true
    log_end_msg 1 || true
  fi
}

do_stop() {
  log_daemon_msg "Stopping OpenSCAP dbus service" "oscapd" || true
  if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --remove-pidfile; then
    log_end_msg 0 || true
  else
    log_end_msg 1 || true
  fi
}