PID_FILE="/var/run/stunnel.pid"
CONF_FILE="/tmp/stunnel.conf"
BIN="/usr/bin/stunnel"
+SERVICE_SECTION_FOUND=0
global_defs() {
local debug compression
config_get_bool enabled "$cfg" 'enabled' '1'
[ ${enabled} -gt 0 ] || return 0
+ SERVICE_SECTION_FOUND=1
printf "\n" >> "$CONF_FILE"
printf "[%s]\n" "$cfg" >> "$CONF_FILE"
rm -f "$CONF_FILE"
# Symlink "alt_config_file" since it's a bit easier and safer
ln -s "$alt_config_file" "$CONF_FILE"
+ # Set section found to start service user hopfully knows what you does
+ SERVICE_SECTION_FOUND=1
return 0
}
}
start_service() {
- procd_open_instance
- procd_set_param command "$BIN"
- procd_append_param command "$CONF_FILE"
-
process_config
- # set auto respawn behavior
- procd_set_param respawn
- procd_set_param file "$CONF_FILE"
- procd_close_instance
+ if [ "$SERVICE_SECTION_FOUND" = 1 ]; then
+ procd_open_instance
+ procd_set_param command "$BIN"
+ procd_append_param command "$CONF_FILE"
+ procd_set_param respawn
+ procd_set_param file "$CONF_FILE"
+ procd_close_instance
+ else
+ logger -t stunnel -p daemon.info "No uci service section enabled or found!"
+ fi
}