Hi developers:
I'm not a coding guy but I ran across a neat thread in another forum. Perhaps you would like to include the script in Phpwcms as a way to backup the mysql database periodically. Just a thought.
http://forum.powweb.com/showthread.php? ... ge=1&pp=25
Mysql backup script available
i've got a shell script which also rotates the backup-files
i call it from a cronjob via a php-script:
Cheers
SNap
Code: Select all
#!/bin/sh
# script for backing up typo3-database of the vhb projects.
# assumptions: only backup-files are stored in the directory specified
# in the variable BACKUP_PATH
# variable stores the date in the pattern 'YYYY-MM-DD'
DATE=`date +%Y-%m-%d-%T`
# specifies the path where the backups should be stored (must exist!)
BACKUP_PATH="/somepath/backups"
# specifies how many backup files should be kept
NUMBER_OF_BACKUP_FILES=3
cd $BACKUP_PATH;
# counts the number of files in the backup directory
currentFileNum=`ls -1t | wc -l`
# if the maximal number of backup files is reached, delete the oldest file
# this is done by piping the ls-output(1 file per line and sorted descending
# according to the timestamp) into tail (only displaying the last line), and
# finally removing the file using the xargs command for passing parameters
if [ $currentFileNum -ge $NUMBER_OF_BACKUP_FILES ] ; then
ls -1t | tail -1 | xargs -n 1 rm -fr
fi
# store bzipped mysql-dump
mysqldump -h sqlhost -u user --password="password" --opt database | gzip -c > $BACKUP_PATH/database-$DATE.sql.gz;
i call it from a cronjob via a php-script:
Code: Select all
<?php
echo "starting backup...";
// run shell script
system(sprintf('./scriptname.sh'));
echo "backup finished";
?>
SNap
'welcome to the real world!' datensysteme-lenk
hello
i use TD-backup easy to handle. and i use this with the german http://www.cronjob.de (it's free of charge) service if you have no server!*smile*
iy ou wanna test it you can download it here.
http://www.fhss.de/td_backup.zip
i use TD-backup easy to handle. and i use this with the german http://www.cronjob.de (it's free of charge) service if you have no server!*smile*
iy ou wanna test it you can download it here.
http://www.fhss.de/td_backup.zip
hi again,
both scripts of you are written in mysql and don't take care about rotating dump's....
And dumping with mysqldump is much faster a Dump of my 60MB Database takes about 5-10 seconds.
both scripts of you are written in mysql and don't take care about rotating dump's....
And dumping with mysqldump is much faster a Dump of my 60MB Database takes about 5-10 seconds.
'welcome to the real world!' datensysteme-lenk
what if you not have you own webserver....SNap wrote:hi again,
both scripts of you are written in mysql and don't take care about rotating dump's....
And dumping with mysqldump is much faster a Dump of my 60MB Database takes about 5-10 seconds.
Many of us use a paid webhotel....
http://www.studmed.dk Portal for doctors and medical students in Denmark
i have just webspace, too. but with a ssh
you can do the plain dumping restoring with a php-script like my restore-script with sprintf() you have to ask your provider what shell-commands are availeable. Most providers put these commands like mysqldump in /cgi-bin or /phpbin or likewise....
or better: do an upgrade and get an account with ssh
you can do the plain dumping restoring with a php-script like my restore-script with sprintf() you have to ask your provider what shell-commands are availeable. Most providers put these commands like mysqldump in /cgi-bin or /phpbin or likewise....
or better: do an upgrade and get an account with ssh
'welcome to the real world!' datensysteme-lenk