| #!/bin/sh |
| # |
| ### BEGIN INIT INFO |
| # Provides: iiod |
| # Required-Start: $local_fs $remote_fs |
| # Required-Stop: $local_fs $remote_fs |
| # Default-Start: 2 3 4 5 |
| # Default-Stop: 0 1 6 |
| # Short-Description: IIO Daemon |
| ### END INIT INFO |
| # Debian init.d script for the IIO Daemon |
| # Copyright (C) 2016 Analog Devices Inc. |
| |
| . /lib/lsb/init-functions |
| |
| # Server-side demuxing by default |
| IIOD_OPTS=-D |
| |
| if test -f /etc/default/iiod; then |
| . /etc/default/iiod |
| fi |
| |
| case "$1" in |
| start) |
| log_daemon_msg "Starting IIO Daemon" "iiod" || true |
| if start-stop-daemon -S -b -q -m -p /var/run/iiod.pid -x @CMAKE_INSTALL_FULL_SBINDIR@/iiod -- $IIOD_OPTS; then |
| log_end_msg 0 || true |
| else |
| log_end_msg 1 || true |
| fi |
| ;; |
| |
| stop) |
| log_daemon_msg "Stopping IIO Daemon" "iiod" || true |
| if start-stop-daemon -K -q -p /var/run/iiod.pid; then |
| log_end_msg 0 || true |
| else |
| log_end_msg 1 || true |
| fi |
| ;; |
| |
| restart|force-reload) |
| $0 stop |
| $0 start |
| ;; |
| |
| status) |
| if [ -f /var/run/iiod.pid ] ; then |
| status_of_proc -p /var/run/iiod.pid @CMAKE_INSTALL_FULL_SBINDIR@/iiod iiod && exit 0 || exit $? |
| else |
| status_of_proc @CMAKE_INSTALL_FULL_SBINDIR@/iiod iiod && exit 0 || exit $? |
| fi |
| ;; |
| |
| *) |
| log_action_msg "Usage: /etc/init.d/iiod.sh {start|stop|restart|status}" || true |
| exit 1 |
| esac |
| |
| exit 0 |