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
|
||||
if [ $1 -n]
|
||||
then
|
||||
echo "Please provide a number to set swappiness value!" && exit 1
|
||||
else
|
||||
echo "vm.swappiness="$1
|
||||
if [ $(id -u) -ne 0 ]
|
||||
then echo "Please run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue