mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
implement additional rc scripting start, fix for https://github.com/opnsense/core/issues/94
uses a more standard approach to startup daemons via the rc.d system. To enable, place a file for your service in /etc/rc.conf.d/ and set the enable variable to YES ( for example squid_enable=YES )
This commit is contained in:
parent
353b07b7de
commit
f290b78c5b
@ -282,6 +282,9 @@ echo -n "Starting CRON... "
|
||||
cd /tmp && /usr/sbin/cron -s 2>/dev/null
|
||||
echo "done."
|
||||
|
||||
# starting standard rc scripts
|
||||
/usr/local/etc/rc.opnsense start
|
||||
|
||||
# Start ping handler every 240 seconds
|
||||
/usr/local/bin/minicron 240 /var/run/ping_hosts.pid /usr/local/bin/ping_hosts.sh
|
||||
|
||||
|
||||
28
src/etc/rc.opnsense
Executable file
28
src/etc/rc.opnsense
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# check which services to enable
|
||||
. /etc/rc.conf
|
||||
for rc_conf in /etc/rc.conf.d/*;
|
||||
do
|
||||
. $rc_conf
|
||||
done
|
||||
|
||||
# probe all deamons in /usr/local/etc/rc.d/
|
||||
ls /usr/local/etc/rc.d/* | while read rc_filename
|
||||
do
|
||||
# echo $rc_filename
|
||||
# read rc scripts and parse name and rcvar variables
|
||||
_file=`basename $rc_filename`
|
||||
eval `/usr/bin/grep "name[[:blank:]]*=" $rc_filename | /usr/bin/head -n 1`
|
||||
eval `grep "rcvar[[:blank:]]*=" $rc_filename | /usr/bin/sed '/^$/d'`
|
||||
|
||||
# check if service is enabled
|
||||
eval "is_enabled=\$"$rcvar""
|
||||
|
||||
# start/stop service
|
||||
if [ "$is_enabled" == "YES" ]; then
|
||||
$rc_filename $1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user