Skip to content

Commit

Permalink
completed database and user removal tools
Browse files Browse the repository at this point in the history
  • Loading branch information
pbredenberg committed Apr 10, 2016
1 parent a525b0b commit d5b663c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
# Check dependencies for mission critical stuff
type zip >/dev/null 2>&1 || echo "The package 'zip' is not installed on your system, so installing..." && apt-get install zip

# Make task scripts executlable
chmod +x lempdash
find ./tasks/ -type f -exec /bin/sh -c "file {} | grep -q executable && chmod +x {}" \;

# Copy all the things into bin

mkdir -p /opt/lempdash/tasks
cp -R tasks /opt/lempdash
cp lempdash /bin/ldash

# Make task scripts executlable
chmod +x /bin/ldash
find /opt/lempdash/tasks/ -type f -exec /bin/sh -c "file {} | grep -q executable && chmod +x {}" \;
2 changes: 1 addition & 1 deletion lempdash
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ elif [ $1 = "rm" ]; then
# REMOVE DATABASE USER
elif [ $2 = "dbuser" ]; then
if [ $# = 3 ]; then
echo "Dropping user: $3" "$3"
echo "Dropping user: " $3
/opt/lempdash/tasks/mysql/removeuser "$3"
else
echo $ADDRESSEE$DONTF"specify a user name: ldash rm dbuser USERNAME"
Expand Down
6 changes: 3 additions & 3 deletions tasks/mysql/removedb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

MYSQL=`which mysql`
CURRENT_TIME=$(date "+%Y%m%d-%H%M%S")
FILE_NAME=$CURRENT_TIME'.sql'
FILE_NAME=$1$CURRENT_TIME'.sql'

Q1="DROP DATABASE IF EXISTS $1;"
SQL="${Q1}"
SQL="$Q1"

echo "First I'll need your MySQL root user password to backup your database."
read -sp 'Password: ' PASSVAR

mkdir -p /var/www/archive
mysqldump -uroot -p$PASSVAR $Q1 > /var/www/archive/$Q1$CURRENT_TIME'.sql'
mysqldump -uroot -p$PASSVAR $1 > /var/www/archive/$FILE_NAME

$MYSQL -uroot -p$PASSVAR -e "$SQL"

0 comments on commit d5b663c

Please sign in to comment.