Created
September 15, 2011 08:26
-
-
Save lrkwz/1218821 to your computer and use it in GitHub Desktop.
Safe backup liferay.
This file contains hidden or 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
#!/bin/bash | |
DBUSR=**** | |
DBPWD=**** | |
# You should be root | |
if [ "$(whoami)" != "root" ]; then | |
echo "Sorry, you are not root." | |
exit 1 | |
fi | |
DATE=$(date "+%F.%R") | |
### Stop Tomcat | |
/opt/liferay-portal-6.0.5/tomcat-6.0.26/bin/shutdown.sh | |
echo "Waiting for shutdown to complete..." | |
while [ "x" = "x" ] | |
do | |
netstat -an | grep 8080 | grep LISTEN 1> /dev/null 2>&1 | |
if [ "$?" -ne "0" ] | |
then | |
break | |
else | |
echo "... still waiting" | |
sleep 1 | |
fi | |
done | |
rm -Rf /opt/liferay-portal-6.0.5/tomcat-6.0.26/temp/* | |
rm -Rf /opt/liferay-portal-6.0.5/tomcat-6.0.26/work/* | |
rm -Rf /opt/liferay-portal-6.0.5/tomcat-6.0.26/logs/* | |
### Copy files | |
rsync -rav /opt/liferay-portal-6.0.5/ /opt/liferay-portal-CLONE/ | |
### Dump DB | |
mysqldump --opt -u $DBUSR -p$DBPWD --databases lportal lportal_dev > lportal_$DATE.sql | |
/opt/liferay-portal-6.0.5/tomcat-6.0.26/bin/startup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment