diff --git a/spod-manager.sh b/spod-manager.sh index 4ee1d8e..2fb475d 100755 --- a/spod-manager.sh +++ b/spod-manager.sh @@ -91,7 +91,7 @@ while true; do echo " " echo "list of arguments:" echo "-h, --help show commands help" - echo "-a, --action=ACTION specify an action install, uninstall, update and backup." + echo "-a, --action=ACTION specify an action install, uninstall, update, backup, restore." echo "-m, --mysql-username=username specify the username of mysql (*)." echo "-n, --mysql-password=password specify the password of mysql server (*)." echo "-o, --mysql-address=address specify the address of mysql server (deafult is localhost)." @@ -100,7 +100,7 @@ while true; do echo "-r, --spod-git-password=password specify the passoword of SPOD git server (*)." echo "-s, --spod-git-address=address:port specify the SPOD git server (deafult is service.routetopa.eu:7480)." echo "-w, --spod-hostname=hostname specify the SPOD host name (example http://spod.routetopa.eu/)." - echo "-d, --spod-database-version=db specify the SPOD db git path located in db_dump of SPOD git core (example oxwall_v.0.1_antares.sql, deafults is really simple SPOD and Oxwall installation)." + echo "-d, --spod-database-version=db specify the SPOD db git path located in db_dump of SPOD git core (example in backup action: oxwall_v.0.1_antares.sql, deafults is really simple SPOD and Oxwall installationi; in restore action use a local db dump)." echo "-b, --backup-dir=DIR specify the directory where store the spod backup (default is current directory)." echo "* the arguments is required." exit 0; @@ -234,6 +234,17 @@ echo "SPOD MANAGER Action: $ACTION ..." cp -r /var/www $BACKUPDIR/$DATEDIR/var service apache2 start ;; + "restore") + if [ -z "$MYSQLUSERNAME" ] || [ -z "$MYSQLPASSWORD" ] ; + then + echo "You must specify the mysql password and username to unistall SPOD." + exit -2 + fi + service apache2 stop + mysql -u $MYSQLUSERNAME -p$MYSQLPASSWORD --host=$MYSQLHOST -e "create database if not exists oxwall;" + mysql -u $MYSQLUSERNAME -p$MYSQLPASSWORD --host=$MYSQLHOST --database=oxwall < $DB + service apache2 start + ;; "update") if [ -z "$GITUSER" ] || [ -z "$GITEMAIL" ] || [ -z "$GITPASSWORD" ] ; then