aboutsummaryrefslogtreecommitdiff
path: root/sysutils/swapd/files/swapd_swapon
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/swapd/files/swapd_swapon')
-rw-r--r--sysutils/swapd/files/swapd_swapon16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysutils/swapd/files/swapd_swapon b/sysutils/swapd/files/swapd_swapon
new file mode 100644
index 000000000000..18ed94a43507
--- /dev/null
+++ b/sysutils/swapd/files/swapd_swapon
@@ -0,0 +1,16 @@
+#!/bin/sh
+swapfile=$1
+if [ -z "$swapfile" ]; then
+ echo "usage: $0 swapfile"
+ exit 1
+fi
+if [ ! -f $swapfile ]; then
+ echo "$0: swapfile '$swapfile' not found"
+ exit 1
+fi
+mdev=`/sbin/mdconfig -a -t vnode -f ${swapfile}`
+if [ -z "$mdev" ]; then
+ echo "$0: unable to create vnode for swapfile '$swapfile'"
+ exit 1
+fi
+/sbin/swapon /dev/${mdev}