mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-17 03:25:46 +00:00
83eb2c3700
literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
34 lines
603 B
Bash
34 lines
603 B
Bash
#!/bin/sh
|
|
#
|
|
# swapmon - add / remove swap as needed
|
|
#
|
|
# PROVIDE: swapmon
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf to enable swapmon:
|
|
#
|
|
#swapmon_enable="YES"
|
|
#
|
|
. /etc/rc.subr
|
|
|
|
name=swapmon
|
|
rcvar=swapmon_enable
|
|
|
|
command="%%PREFIX%%/sbin/${name}"
|
|
command_interpreter="/bin/sh"
|
|
|
|
CONFIG=%%PREFIX%%/etc/${name}rc
|
|
if [ -r "${CONFIG}" ]
|
|
then . "${CONFIG}"
|
|
fi
|
|
pidfile=${PIDFILE:-"/var/run/${name}.pid"}
|
|
swapmon_enable=${swapmon_enable:-"NO"}
|
|
|
|
load_rc_config ${name}
|
|
start_precmd='command_args="-F <&- 2>&1 >/dev/null &"'
|
|
stop_postcmd='rm $pidfile'
|
|
|
|
run_rc_command "$1"
|
|
|