1#!/bin/sh 2# 3### BEGIN INIT INFO 4# Provides: iiod 5# Required-Start: $local_fs $remote_fs 6# Required-Stop: $local_fs $remote_fs 7# Default-Start: 2 3 4 5 8# Default-Stop: 0 1 6 9# Short-Description: IIO Daemon 10### END INIT INFO 11# Debian init.d script for the IIO Daemon 12# Copyright (C) 2016 Analog Devices Inc. 13 14. /lib/lsb/init-functions 15 16# Server-side demuxing by default 17IIOD_OPTS=-D 18 19if test -f /etc/default/iiod; then 20 . /etc/default/iiod 21fi 22 23case "$1" in 24 start) 25 log_daemon_msg "Starting IIO Daemon" "iiod" || true 26 if start-stop-daemon -S -b -q -m -p /var/run/iiod.pid -x @CMAKE_INSTALL_FULL_SBINDIR@/iiod -- $IIOD_OPTS; then 27 log_end_msg 0 || true 28 else 29 log_end_msg 1 || true 30 fi 31 ;; 32 33 stop) 34 log_daemon_msg "Stopping IIO Daemon" "iiod" || true 35 if start-stop-daemon -K -q -p /var/run/iiod.pid; then 36 log_end_msg 0 || true 37 else 38 log_end_msg 1 || true 39 fi 40 ;; 41 42 restart|force-reload) 43 $0 stop 44 $0 start 45 ;; 46 47 status) 48 if [ -f /var/run/iiod.pid ] ; then 49 status_of_proc -p /var/run/iiod.pid @CMAKE_INSTALL_FULL_SBINDIR@/iiod iiod && exit 0 || exit $? 50 else 51 status_of_proc @CMAKE_INSTALL_FULL_SBINDIR@/iiod iiod && exit 0 || exit $? 52 fi 53 ;; 54 55 *) 56 log_action_msg "Usage: /etc/init.d/iiod.sh {start|stop|restart|status}" || true 57 exit 1 58esac 59 60exit 0 61