xref: /OK3568_Linux_fs/buildroot/package/ser2net/S50ser2net (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
3# Startup script for ser2net
4#
5
6start() {
7    printf  "Starting ser2net: "
8    if [ ! -f /etc/ser2net.conf ] && [ ! -f /etc/ser2net/ser2net.yaml ] ; then
9	echo "no configuration file"
10	exit 1
11    fi
12
13    start-stop-daemon -S -q --exec /usr/sbin/ser2net -- -P /var/run/ser2net.pid
14    [ $? = 0 ] && echo "OK" || echo "FAIL"
15}
16
17stop() {
18    printf "Shutting down ser2net: "
19    start-stop-daemon -K -q -p /var/run/ser2net.pid
20    [ $? = 0 ] && echo "OK" || echo "FAIL"
21}
22
23restart() {
24    stop
25    start
26}
27
28case "$1" in
29	start)
30	    start
31	    ;;
32	stop)
33	    stop
34	    ;;
35	restart)
36	    restart
37	    ;;
38	*)
39	    echo "Usage: ser2net {start|stop|restart}"
40	    exit 1
41esac
42
43exit $?
44