-
Notifications
You must be signed in to change notification settings - Fork 759
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement additional rc scripting start, fix for #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 )
- Loading branch information
1 parent
353b07b
commit f290b78
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
|
||
|
|