cmkelley
Very Senior Member
I got tired of typing '/opt/etc/init/S01syslog-ng restart', particularly when there's a perfectly good "service action_target" mechanism for the firmware services. So, not knowing any better, I set out to remedy that situation (it's late, I'm punchy, bear with me). In the spirit of the "add one line" mantra, it requires only a single line to be added to /jffs/scripts/service-event:
If you don't already have a /jffs/scripts/service-event script, create one:
and make it executable
Create a /jffs/scripts/entware-service file (sorry, no fancy installer):
and make it executable
Now you can restart Entware services with eg. "service restart_syslog-ng", "service restart_stubby", etc.
Annoyingly enough, just like when restarting a firmware service, you have to look in /tmp/syslog.log to see if it worked or not. Seriously, you can type "service tango_uniform" and it will reply with "Done."
EDIT: added -x test for /opt/bin/find as discussed in comments
Code:
/jffs/scripts/entware-service "$1" "$2" & # service ACTION_TARGET for Entware
Code:
#!/bin/sh
/jffs/scripts/entware-service "$1" "$2" & # service ACTION_TARGET for Entware
Code:
chmod +x /jffs/scripts/service-event
Code:
#!/bin/sh
#tof
# allow f/w "service" command to work on Entware services
# - services must be defined as /opt/etc/init.d/S##service_name
# - S##service_name must be an executable shell script
ACTION=$1
TARGET=$2
if [ $# -lt 2 ] || [ ! -x /opt/bin/find ]
then
exit 1
fi
SRVNAME="$(/opt/bin/find /opt/etc/init.d/ -perm '-u+x' -name "S[0-9][0-9]$TARGET")"
if [ "X$SRVNAME" != "X" ]
then
$SRVNAME $ACTION
fi
#eof
Code:
chmod +x /jffs/scripts/entware-service
Annoyingly enough, just like when restarting a firmware service, you have to look in /tmp/syslog.log to see if it worked or not. Seriously, you can type "service tango_uniform" and it will reply with "Done."
EDIT: added -x test for /opt/bin/find as discussed in comments
Last edited: