Commit e78d92cd authored by Michiel de Jong's avatar Michiel de Jong

fix the way mysql and backups are started

parent 6199b6cd
#!/bin/bash
git config --global user.email "backup@IndieHosters"
git config --global user.name "IndieHosters backup"
exec mysqld_safe &
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
echo "Waiting for database server..."
sleep 1
done
mkdir -p /data/uploads
mkdir -p /data/www-content
touch /data/dump.sql
chown -R root:www-data /data/uploads
chown -R root:www-data /data
chmod -R 770 /data/uploads
chmod -R 750 /data/www-content
exec mysqld_safe &
exec cron &
sleep 5
mysql < /data/dump.sql
source /etc/apache2/envvars
exec apache2 &
cd /data
while (1); do
mysqldump --all-databases > dump.sql;
git add *;
git commit -am"backup `date`";
git status;
date;
echo "Next backup in one hour...";
sleep 3540;
git init
git config --local user.email "backup@IndieHosters"
git config --local user.name "IndieHosters backup"
git config --local push.default simple
while true; do
mysqldump --all-databases > dump.sql
git add *
git commit -am"backup `date`"
git status
date
echo "Next backup in one hour..."
sleep 3540
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment