summaryrefslogtreecommitdiff
path: root/sysutils/swapd/files/swapd_swapon
blob: 18ed94a43507632aa8e5f238e79342e27089c937 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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}