Merge pull request 'Add FreeBSD example rc script' (#25) from ecliptik/molly-brown:freebsd-rc-example into master
Reviewed-on: #25
This commit is contained in:
commit
e42c366565
17
README.md
17
README.md
|
@ -165,6 +165,23 @@ You can start your `mollybrownd` daemon with `rcctl`:
|
||||||
rcctl start mollybrownd
|
rcctl start mollybrownd
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### FreeBSD
|
||||||
|
|
||||||
|
An example FreeBSD rc script is in
|
||||||
|
`contrib/init/molly-brown.freebsd.example`.
|
||||||
|
|
||||||
|
Copy rc script to `/etc/rc.d/molly`, and add `molly_enable="YES"`
|
||||||
|
to `/etc/rc.conf` to enable the service.
|
||||||
|
|
||||||
|
Make sure the `daemon` user has access to config locations in
|
||||||
|
`molly.conf` like `CertPath`, `KeyPath`, `DocBase`, etc.
|
||||||
|
|
||||||
|
Start `molly` with,
|
||||||
|
|
||||||
|
```
|
||||||
|
service molly start
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration Options
|
## Configuration Options
|
||||||
|
|
||||||
The following sections detail all the options which can be set in
|
The following sections detail all the options which can be set in
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# $FreeBSD$
|
||||||
|
#
|
||||||
|
|
||||||
|
# PROVIDE: molly
|
||||||
|
# REQUIRE: networking
|
||||||
|
# KEYWORD: shutdown
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="molly"
|
||||||
|
desc="Gemini Protocol daemon"
|
||||||
|
rcvar="molly_enable"
|
||||||
|
command="/usr/local/sbin/molly-brown"
|
||||||
|
command_args="-c /etc/molly.conf"
|
||||||
|
molly_brown_user="daemon"
|
||||||
|
pidfile="/var/run/${name}.pid"
|
||||||
|
required_files="/etc/molly.conf"
|
||||||
|
|
||||||
|
start_cmd="molly_start"
|
||||||
|
stop_cmd="molly_stop"
|
||||||
|
status_cmd="molly_status"
|
||||||
|
|
||||||
|
molly_start() {
|
||||||
|
/usr/sbin/daemon -P ${pidfile} -r -f -u $molly_brown_user $command
|
||||||
|
}
|
||||||
|
|
||||||
|
molly_stop() {
|
||||||
|
if [ -e "${pidfile}" ]; then
|
||||||
|
kill -s TERM `cat ${pidfile}`
|
||||||
|
else
|
||||||
|
echo "${name} is not running"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
molly_status() {
|
||||||
|
if [ -e "${pidfile}" ]; then
|
||||||
|
echo "${name} is running as pid `cat ${pidfile}`"
|
||||||
|
else
|
||||||
|
echo "${name} is not running"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
run_rc_command "$1"
|
Loading…
Reference in New Issue