Commit 6a03969da4e227953c45de677b860adce1b79301
1 parent
4428cdc7
update restore action
Showing
1 changed file
with
13 additions
and
2 deletions
spod-manager.sh
| @@ -91,7 +91,7 @@ while true; do | @@ -91,7 +91,7 @@ while true; do | ||
| 91 | echo " " | 91 | echo " " |
| 92 | echo "list of arguments:" | 92 | echo "list of arguments:" |
| 93 | echo "-h, --help show commands help" | 93 | echo "-h, --help show commands help" |
| 94 | - echo "-a, --action=ACTION specify an action install, uninstall, update and backup." | 94 | + echo "-a, --action=ACTION specify an action install, uninstall, update, backup, restore." |
| 95 | echo "-m, --mysql-username=username specify the username of mysql (*)." | 95 | echo "-m, --mysql-username=username specify the username of mysql (*)." |
| 96 | echo "-n, --mysql-password=password specify the password of mysql server (*)." | 96 | echo "-n, --mysql-password=password specify the password of mysql server (*)." |
| 97 | echo "-o, --mysql-address=address specify the address of mysql server (deafult is localhost)." | 97 | echo "-o, --mysql-address=address specify the address of mysql server (deafult is localhost)." |
| @@ -100,7 +100,7 @@ while true; do | @@ -100,7 +100,7 @@ while true; do | ||
| 100 | echo "-r, --spod-git-password=password specify the passoword of SPOD git server (*)." | 100 | echo "-r, --spod-git-password=password specify the passoword of SPOD git server (*)." |
| 101 | echo "-s, --spod-git-address=address:port specify the SPOD git server (deafult is service.routetopa.eu:7480)." | 101 | echo "-s, --spod-git-address=address:port specify the SPOD git server (deafult is service.routetopa.eu:7480)." |
| 102 | echo "-w, --spod-hostname=hostname specify the SPOD host name (example http://spod.routetopa.eu/)." | 102 | echo "-w, --spod-hostname=hostname specify the SPOD host name (example http://spod.routetopa.eu/)." |
| 103 | - 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)." | 103 | + 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)." |
| 104 | echo "-b, --backup-dir=DIR specify the directory where store the spod backup (default is current directory)." | 104 | echo "-b, --backup-dir=DIR specify the directory where store the spod backup (default is current directory)." |
| 105 | echo "* the arguments is required." | 105 | echo "* the arguments is required." |
| 106 | exit 0; | 106 | exit 0; |
| @@ -234,6 +234,17 @@ echo "SPOD MANAGER Action: $ACTION ..." | @@ -234,6 +234,17 @@ echo "SPOD MANAGER Action: $ACTION ..." | ||
| 234 | cp -r /var/www $BACKUPDIR/$DATEDIR/var | 234 | cp -r /var/www $BACKUPDIR/$DATEDIR/var |
| 235 | service apache2 start | 235 | service apache2 start |
| 236 | ;; | 236 | ;; |
| 237 | + "restore") | ||
| 238 | + if [ -z "$MYSQLUSERNAME" ] || [ -z "$MYSQLPASSWORD" ] ; | ||
| 239 | + then | ||
| 240 | + echo "You must specify the mysql password and username to unistall SPOD." | ||
| 241 | + exit -2 | ||
| 242 | + fi | ||
| 243 | + service apache2 stop | ||
| 244 | + mysql -u $MYSQLUSERNAME -p$MYSQLPASSWORD --host=$MYSQLHOST -e "create database if not exists oxwall;" | ||
| 245 | + mysql -u $MYSQLUSERNAME -p$MYSQLPASSWORD --host=$MYSQLHOST --database=oxwall < $DB | ||
| 246 | + service apache2 start | ||
| 247 | + ;; | ||
| 237 | "update") | 248 | "update") |
| 238 | if [ -z "$GITUSER" ] || [ -z "$GITEMAIL" ] || [ -z "$GITPASSWORD" ] ; | 249 | if [ -z "$GITUSER" ] || [ -z "$GITEMAIL" ] || [ -z "$GITPASSWORD" ] ; |
| 239 | then | 250 | then |