projects
/
webi-installers
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor fixes
[webi-installers/.git]
/
vps-addswap
/
install.sh
diff --git
a/vps-addswap/install.sh
b/vps-addswap/install.sh
index f1f559f859ba2e40b96c4062fb363406f62256ff..e3e3702d254d2621cfe8e96b45373f76831c6867 100644
(file)
--- a/
vps-addswap/install.sh
+++ b/
vps-addswap/install.sh
@@
-7,6
+7,16
@@
default_size=2G
my_size=${1:-$default_size}
default_size=2G
my_size=${1:-$default_size}
+ if [ "0" != "$EUID" ] && [ "0" != "$UID" ]; then
+ echo Usage:
+ echo ' sudo env PATH="$PATH" vps-addswap' $my_size
+ exit 1
+ fi
+
+ if [ -f "/var/swapfile" ]; then
+ swapoff /var/swapfile
+ fi
+
# Allocate a swapfile
fallocate -l "$my_size" /var/swapfile
# Allocate a swapfile
fallocate -l "$my_size" /var/swapfile
@@
-20,5
+30,4
@@
# Cause swap to be activated on boot
echo '/var/swapfile none swap sw 0 0' | tee -a /etc/fstab
# Cause swap to be activated on boot
echo '/var/swapfile none swap sw 0 0' | tee -a /etc/fstab
-
}
}