Trying to create the /etc/init.d/suricata file for the package. I'm using the existing snort3 init.d file as a starter
It doesn't seem to create the local variables. The echo "Validated ${config_file} and ${interface}" returns no values. I've tried it with just $config_file and $interface with the same results..
It works with the direct call procd_set_param command $PROG -i eth0 -c /etc/suricata/suricata.yaml --pidfile /var/log/suricata.pid -D but not with the variable calls..
uci show suricata
root@OpenWrt:/etc/init.d# uci show suricata
suricata.service=suricata
suricata.service.interface='eth0'
suricata.service.config_file='/etc/suricata/suricata.yaml'
root@OpenWrt:/etc/init.d#
the config_load seems to have worked.. but, now it's a procd issue.. It won't run when I use the variables, even though they expand properly. If I run the command and fill in the spots where the vars are, it runs fine.
When I run that, the service never starts.. If I replace the procd string with an echo on the front, it fills fine.
root@OpenWrt:~# service suricata start
Validated /etc/suricata/suricata.yaml and eth0
procd_set_param command /usr/bin/suricata -i eth0 -c /etc/suricata/suricata.yaml --pidfile /var/log/suricata.pid -D
Validated /etc/suricata/suricata.yaml and eth0 2
Can you think of any reason procd_set_param command ${PROG} -i ${interface} -c ${config_file} --pidfile /var/log/suricata.pid -D doesn't do anything unless fill in the blanks (except PROG)?
Perhaps you shouldn't use --pidfile since it is managed by procd_set_param pidfile.
You may also need to avoid daemonizing/forking -D and just run in foreground.