Init-Skript xendriverdomain: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Die Seite wurde neu angelegt: „Init-Skript '''/etc/init.d/xndriverdomain''' <pre> #!/bin/sh ### BEGIN INIT INFO # Provides: xendriverdomain # Required-Start: $syslog $remote_fs $…“ |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
Init-Skript '''/etc/init.d/ | Init-Skript '''/etc/init.d/xendriverdomain''' | ||
<pre> | <pre> | ||
#!/bin/sh | #!/bin/sh |
Aktuelle Version vom 13. Januar 2021, 21:04 Uhr
Init-Skript /etc/init.d/xendriverdomain
#!/bin/sh ### BEGIN INIT INFO # Provides: xendriverdomain # Required-Start: $syslog $remote_fs $network # Required-Stop: $syslog $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Xen driverdomain daemon # Description: Xen driverdomain daemon ### END INIT INFO . /lib/init/vars.sh . /lib/lsb/init-functions PATH=/sbin:/bin:/usr/sbin:/usr/bin DESC="Xen driverdomain daemon" case "$(cat /sys/hypervisor/type 2>/dev/null)" in xen) ;; *) exit 0 ;; # not running under Xen esac VERSION=$(/usr/lib/xen-common/bin/xen-version) ROOT=$(/usr/lib/xen-common/bin/xen-dir) if [ $? -ne 0 ]; then log_warning_msg "No compatible Xen utils for Xen $VERSION" exit 1 fi XENDRIVERDOMAIN="/usr/sbin/xl" XENDRIVERDOMAIN_PIDFILE="/run/xendriverdomain.pid" XENDRIVERDOMAIN_ARGS="devd -p /run/xendriverdomain.pid 2>/dev/null" modules_setup() { modprobe xenfs 2>/dev/null modprobe xen-evtchn 2>/dev/null modprobe xen-gntdev 2>/dev/null modprobe xen-acpi-processor 2>/dev/null } xenfs_setup() { [ -e "/proc/xen/capabilities" ] && return 0 log_progress_msg "xenfs" [ -d "/proc/xen" ] || return 1 mount -t xenfs xenfs /proc/xen || return 1 return 0 } capability_check() { [ -d "/proc/xen" ] || return 1 [ -e "/proc/xen/capabilities" ] || return 1 return 0 } xendriverdomain_start() { log_progress_msg "xendriverdomain" xendriverdomain_start_real return $? } xendriverdomain_stop() { log_progress_msg "xendriverdomain" xendriverdomain_stop_real return $? } xendriverdomain_restart() { log_progress_msg "xendriverdomain" xendriverdomain_stop_real case "$?" in 0|1) xendriverdomain_start_real case "$?" in 0) ;; *) return 2 ;; esac ;; *) return 2 ;; esac return 0 } xendriverdomain_start_real() { start-stop-daemon --start --quiet --pidfile "$XENDRIVERDOMAIN_PIDFILE" --exec "$XENDRIVERDOMAIN" -- \ $XENDRIVERDOMAIN_ARGS --pid-file "$XENDRIVERDOMAIN_PIDFILE" \ || return 2 } xendriverdomain_stop_real() { start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile "$XENDRIVERDOMAIN_PIDFILE" --name xendriverdomain RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 kill `cat $XENDRIVERDOMAIN_PIDFILE` for pid in `ps aux | grep -v grep | grep 'xl devd' | awk '{print $2}'`; do kill $pid done rm -f $XENDRIVERDOMAIN_PIDFILE return "$RETVAL" } case "$1" in start) log_daemon_msg "Starting $DESC" modules_setup xenfs_setup case "$?" in 0) ;; *) log_end_msg 1; exit ;; esac capability_check case "$?" in 0) ;; *) log_end_msg 0; exit ;; # not a dom0, skip the rest esac xendriverdomain_start case "$?" in 0) ;; *) log_end_msg 0; exit ;; # not a dom0, skip the rest esac log_end_msg 0 ;; stop) xendriverdomain_stop case "$?" in 0|1) ;; *) ret=1 ;; esac log_daemon_msg "Stopping $DESC" ret=0 log_end_msg $ret ;; restart|force-reload) xendriverdomain_start case "$?" in 0) ;; *) log_end_msg 0; exit ;; # not a dom0, skip the rest esac log_daemon_msg "Restarting $DESC" ret=0 log_end_msg $ret ;; *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0