- Linux
- 2008-03-19 - 更新:2014-05-28
この記事は最終更新日から1年以上経過しています。
PHP5 —–
[ /usr/local/bin/backup ]
#!/bin/sh THISDAY=`date +%F_%H-%M-%S` cd /var/lib/mysql tar -cvzf /usr/tmp/mysql_"$THISDAY".tgz * /usr/local/bin/php -f /var/www/html/cli/backupper.php ‐‐ \ /usr/tmp/mysql_"$THISDAY".tgz #if [ $? -eq 0 ] ; then #rm -rf /usr/tmp/mysql_"$THISDAY".tgz #fi
[cronに登録(2日毎、午前10時に実行)]
0 10 */2 * * /usr/local/bin/backup
PHP4 —–
[ /usr/local/bin/backup ]
#!/bin/sh THISDAY=`date +%F_%H-%M-%S` cd /var/lib/mysql tar -cvzf /usr/tmp/mysql_"$THISDAY".tgz * /usr/bin/php -f /var/www/html/cli/backupper.php \ /usr/tmp/mysql_"$THISDAY".tgz
[cronに登録(2日毎、午前10時に実行)]
0 10 */2 * * /usr/local/bin/backup
1,700 views