diff options
| author | Armin Kuster <akuster808@gmail.com> | 2018-03-05 16:47:54 -0800 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2018-05-17 08:32:26 -0700 |
| commit | 51411b3c7af5df603d341f0cd2641cf55847f564 (patch) | |
| tree | f586cf77f0241821faffd1064887e33e6e1c76ff /meta-networking/recipes-connectivity/mosquitto/files/mosquitto.init | |
| parent | 251878e8b6b993b159c949f7e4860faf085e17f5 (diff) | |
| download | meta-openembedded-51411b3c7af5df603d341f0cd2641cf55847f564.tar.gz | |
mosquito: move from oe to networking layer
mosquito has dependancy on meta-netowrking packages
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-networking/recipes-connectivity/mosquitto/files/mosquitto.init')
| -rw-r--r-- | meta-networking/recipes-connectivity/mosquitto/files/mosquitto.init | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/mosquitto/files/mosquitto.init b/meta-networking/recipes-connectivity/mosquitto/files/mosquitto.init new file mode 100644 index 0000000000..d2a27b2732 --- /dev/null +++ b/meta-networking/recipes-connectivity/mosquitto/files/mosquitto.init | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | # Based on the Debian initscript for mosquitto | ||
| 4 | |||
| 5 | ### BEGIN INIT INFO | ||
| 6 | # Provides: mosquitto | ||
| 7 | # Required-Start: $remote_fs $syslog | ||
| 8 | # Required-Stop: $remote_fs $syslog | ||
| 9 | # Default-Start: 2 3 4 5 | ||
| 10 | # Default-Stop: 0 1 6 | ||
| 11 | # Short-Description: mosquitto MQTT v3.1 message broker | ||
| 12 | # Description: | ||
| 13 | # This is a message broker that supports version 3.1 of the MQ Telemetry | ||
| 14 | # Transport (MQTT) protocol. | ||
| 15 | # | ||
| 16 | # MQTT provides a method of carrying out messaging using a publish/subscribe | ||
| 17 | # model. It is lightweight, both in terms of bandwidth usage and ease of | ||
| 18 | # implementation. This makes it particularly useful at the edge of the network | ||
| 19 | # where a sensor or other simple device may be implemented using an arduino for | ||
| 20 | # example. | ||
| 21 | ### END INIT INFO | ||
| 22 | |||
| 23 | set -e | ||
| 24 | |||
| 25 | PIDFILE=@LOCALSTATEDIR@/run/mosquitto.pid | ||
| 26 | DAEMON=@SBINDIR@/mosquitto | ||
| 27 | |||
| 28 | # start and stop the mosquitto MQTT message broker | ||
| 29 | |||
| 30 | test -x ${DAEMON} || exit 0 | ||
| 31 | |||
| 32 | umask 022 | ||
| 33 | |||
| 34 | . @SYSCONFDIR@/init.d/functions | ||
| 35 | |||
| 36 | export PATH="${PATH:+$PATH:}@SBINDIR@:@BASE_SBINDIR@" | ||
| 37 | |||
| 38 | case "$1" in | ||
| 39 | start) | ||
| 40 | echo "Starting Mosquitto message broker" "mosquitto" | ||
| 41 | if start-stop-daemon --start --quiet --oknodo --background --make-pidfile --pidfile ${PIDFILE} --exec ${DAEMON} ; then | ||
| 42 | exit 0 | ||
| 43 | else | ||
| 44 | exit 1 | ||
| 45 | fi | ||
| 46 | ;; | ||
| 47 | stop) | ||
| 48 | echo "Stopping Mosquitto message broker" "mosquitto" | ||
| 49 | if start-stop-daemon --stop --quiet --oknodo --pidfile ${PIDFILE}; then | ||
| 50 | rm -f ${PIDFILE} | ||
| 51 | exit 0 | ||
| 52 | else | ||
| 53 | exit 1 | ||
| 54 | fi | ||
| 55 | ;; | ||
| 56 | |||
| 57 | |||
| 58 | reload|force-reload) | ||
| 59 | if [ -f ${PIDFILE} ] ; then | ||
| 60 | echo "Reloading configuration for mosquitto" | ||
| 61 | pid=`cat ${PIDFILE}` | ||
| 62 | kill -HUP $pid | ||
| 63 | else | ||
| 64 | echo "mosquitto does not seem to be running" | ||
| 65 | fi | ||
| 66 | ;; | ||
| 67 | |||
| 68 | restart) | ||
| 69 | echo "Restarting Mosquitto message broker" "mosquitto" | ||
| 70 | if start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${PIDFILE}; then | ||
| 71 | rm -f ${PIDFILE} | ||
| 72 | fi | ||
| 73 | if start-stop-daemon --start --quiet --oknodo --background --make-pidfile --pidfile ${PIDFILE} --exec ${DAEMON} -- -c @SYSCONFDIR@/mosquitto/mosquitto.conf ; then | ||
| 74 | exit 0 | ||
| 75 | else | ||
| 76 | exit 1 | ||
| 77 | fi | ||
| 78 | ;; | ||
| 79 | |||
| 80 | status) | ||
| 81 | status ${DAEMON} && exit 0 || exit $? | ||
| 82 | ;; | ||
| 83 | |||
| 84 | *) | ||
| 85 | echo "Usage: $0 {start|stop|reload|force-reload|restart|status}" | ||
| 86 | exit 1 | ||
| 87 | esac | ||
| 88 | |||
| 89 | exit 0 | ||
