Last active
January 30, 2016 17:22
-
-
Save sethwebster/b47f1b54736974ae950c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addUser() { | |
echo "Adding user $1..." | |
adduser $1 | |
gpasswd -a $1 sudo | |
} | |
enableSwap() { | |
echo "Enabling Swap..." | |
sudo fallocate -l 4G /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
sudo sysctl vm.swappiness=10 | |
sudo sysctl vm.vfs_cache_pressure=50 | |
sudo echo "vm.swappiness=10" >> /etc/sysctl.conf | |
sudo echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf | |
} | |
createApp() { | |
dokku apps:create $2 | |
} | |
username="" | |
appname="" | |
echo "Digital Ocean / Dokku Post Setup Script" | |
echo | |
while [[ -z "$username" ]] | |
do | |
read -s -p "Enter new user name: " username | |
echo | |
if [[ $username = "" ]]; then | |
echo "User name cannot be blank." | |
fi | |
done | |
while [[ -z "$appname" ]] | |
do | |
read -s -p "Enter new application name: " appname | |
echo | |
if [[ $appname = "" ]]; then | |
echo "App name cannot be blank." | |
fi | |
done | |
addUser $username | |
enableSwap | |
createApp $appname | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment