initial commit of already existing scripts

This commit is contained in:
2015-06-12 11:42:25 +03:00
commit 92bf42faec
7 changed files with 1017 additions and 0 deletions

37
server/refresh-web-user.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
WEBROOT="/var/www"
read -p "Name of the user which should be refreshed: " USER
WEBDIR="$WEBROOT/$USER"
if [ "$USER" == "" ]; then
echo "User is empty. Abort."
exit 1
elif [ $(grep -q "$USER" /etc/passwd; echo $?) == "1" ]; then
echo "User does not exist. Abort."
exit 1
fi
echo "[INFO] Deleting website..."
rm -rf $WEBDIR/html/*
rm -rf $WEBDIR/html/.*
cat > $WEBDIR/html/default.html << EOF
<html>
<head>
<title>Welcome!</title>
</head>
<body>
<p>Welcome to $USER's website.</p>
<p>This is a placeholder. Please upload content via an SFTP program.</p>
</body>
</html>
EOF
chown $USER:$USER $WEBDIR/html/default.html
echo "[INFO] Cleaning MySQL database..."
mysql -Nse "show tables" $USER | while read table; do mysql -e "drop table $table" $USER; done
echo "[INFO] Done."