Revised service reload functionality

This commit is contained in:
bergware
2023-06-18 03:45:26 +02:00
parent 384fa10575
commit c2065a3d93
2 changed files with 6 additions and 4 deletions

View File

@@ -1,11 +1,12 @@
#!/bin/bash
SERVICES="sshd avahidaemon samba rpc nfsd ntpd nginx"
job=/tmp/atjob.tmp
[[ -n $1 && -e /tmp/atjob.tmp ]] && exit 0
[[ -n $1 && -e $job ]] && exit 0
for cmd in $SERVICES; do
if /etc/rc.d/rc.$cmd update; then
/etc/rc.d/rc.$cmd reload >/dev/null 2>&1
fi
done
touch /tmp/atjob.tmp
touch $job
exit 0

View File

@@ -11,6 +11,7 @@
ini=/var/local/emhttp/network.ini.new
cfg=/boot/config/network.cfg
job=/tmp/atjob.tmp
reload=/usr/local/emhttp/webGui/scripts/reload_services
declare -A VLANID USE_DHCP IPADDR NETMASK GATEWAY METRIC USE_DHCP6 IPADDR6 NETMASK6 GATEWAY6 PRIVACY6 METRIC6 DESCRIPTION PROTOCOL
@@ -221,8 +222,8 @@ done
/usr/bin/mv $ini ${ini%.*}
# delayed execution
rm -f /tmp/atjob.tmp
echo "sleep 40;$reload job"|at -M now 2>/dev/null
rm -f $job
echo "sleep 35;$reload job"|at -M now 2>/dev/null
# send update information
if [[ -n $interface && -n $data && -e /var/run/nginx.socket ]]; then