| 1 | #!/sbin/openrc-run |
| 2 | |
| 3 | name="Sentinel-proxy" |
| 4 | description="A proxy that relays messages received over ZMQ to Sentinel server over MQTT" |
| 5 | |
| 6 | : ${command_user:="sentinel"} |
| 7 | : ${cfgfile:="/etc/sentinel/proxy.cfg"} |
| 8 | : ${syslog:="yes"} |
| 9 | |
| 10 | command="/usr/bin/sentinel-proxy" |
| 11 | command_args=" |
| 12 | --config=$cfgfile |
| 13 | ${logfile:+"--log-file=$logfile"} |
| 14 | ${loglevel:+"--log-level=$loglevel"} |
| 15 | $command_args |
| 16 | " |
| 17 | command_background="yes" |
| 18 | pidfile="/run/$RC_SVCNAME.pid" |
| 19 | |
| 20 | required_files="$cfgfile" |
| 21 | |
| 22 | depend() { |
| 23 | need net |
| 24 | after firewall |
| 25 | } |
| 26 | |
| 27 | start_pre() { |
| 28 | yesno "${syslog-}" && command_args="$command_args --syslog" |
| 29 | |
| 30 | if [ "${logfile-}" ]; then |
| 31 | checkpath -f -m 640 -o "$command_user" "$logfile" || return 1 |
| 32 | fi |
| 33 | } |