backup swap is not required anymore

This commit is contained in:
Girish Ramakrishnan
2016-04-10 20:46:30 -07:00
parent 322e9faee7
commit 8db76f6b70
5 changed files with 6 additions and 69 deletions

View File

@@ -1,41 +0,0 @@
#!/bin/bash
set -eu -o pipefail
if [[ ${EUID} -ne 0 ]]; then
echo "This script should be run as root." > /dev/stderr
exit 1
fi
if [[ $# -eq 0 ]]; then
echo "No arguments supplied"
exit 1
fi
if [[ "$1" == "--check" ]]; then
echo "OK"
exit 0
fi
BACKUP_SWAP_FILE="/backup.swap"
if [[ "$1" == "--on" ]]; then
echo "Mounting backup swap"
if ! swapon -s | grep -q "${BACKUP_SWAP_FILE}"; then
swapon "${BACKUP_SWAP_FILE}"
else
echo "Backup swap already mounted"
fi
fi
if [[ "$1" == "--off" ]]; then
echo "Unmounting backup swap"
if swapon -s | grep -q "${BACKUP_SWAP_FILE}"; then
swapoff "${BACKUP_SWAP_FILE}"
else
echo "Backup swap was not mounted"
fi
fi