建立swapfile脚本文件

This commit is contained in:
2026-01-21 14:49:24 +08:00
parent 537e03f043
commit 7e4088d94f

View File

@@ -0,0 +1,25 @@
#!/bin/sh
. /etc/rc.subr
name="swapfile"
rcvar="swapfile_enable"
start_cmd="swapfile_start"
stop_cmd="swapfile_stop"
swapfile_start()
{
load_rc_config "$name"
mdconfig -a -t vnode -f ${swapfile} -u 0
swapon /dev/md0
}
swapfile_stop()
{
swapoff /dev/md0
mdconfig -d -u 0
}
load_rc_config "$name"
run_rc_command "$1"