checks for root, appends to end of file
This commit is contained in:
parent
f29cf06931
commit
692a4ae608
2 changed files with 11 additions and 5 deletions
|
@ -1,8 +1,14 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if [ $1 -n]
|
if [ $(id -u) -ne 0 ]
|
||||||
then
|
then echo "Please run as root"
|
||||||
echo "Please provide a number to set swappiness value!" && exit 1
|
exit 1
|
||||||
else
|
fi
|
||||||
echo "vm.swappiness="$1
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Please provide a number to set swappiness value!" && exit 2
|
||||||
|
else
|
||||||
|
sudo echo "vm.swappiness="$1 >> /etc/sysctl.conf
|
||||||
|
sudo sysctl -p
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue