summaryrefslogtreecommitdiff
path: root/sysutils/swapd/files/swapd_swapoff
blob: 5e0e52e08587318db3ba4ea59bf79811d9e95edd (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 -l -v | grep ${swapfile} | awk '{print $1}'`
if [ -z "$mdev" ]; then
  echo "$0: swapfile '$swapfile' is not in use"
  exit 1
fi
/sbin/swapoff /dev/${mdev} && /sbin/mdconfig -d -u /dev/${mdev}