Help us understand the problem. What is going on with this article?

redmineのdbをlinuxからwindowsサーバにバックアップ

More than 1 year has passed since last update.

redmineのdbをバックアップ

mysql_backup.sh
#!/bin/sh

dumpfile=/tmp/redmine_`date "+%Y%m%d%H%M"`.dump

find /tmp -mtime +14 -name '*_*.dump' -exec rm -f {} \; >/dev/null 2>&1
mysqldump --defaults-extra-file=/etc/redmine_my.cnf --single-transaction redmine > $dumpfile

exit 0

取得したdumpをwindowsサーバにアップロード

send_file_srv.bat
set DATE_NOW=%date:~0,4%%date:~5,2%%date:~8,2%
set TARGET_DIR=\\Foo\hoge\redmine\%DATE_NOW%
mkdir %TARGET_DIR%

cd "%~dp0%"
start "send_dump"
cscript send_file_srv.vbs

timeout 5
cp *.dump %TARGET_DIR%
del *.dump

pause
send_file_srv.vbs
set WshShell = WScript.CreateObject("WScript.Shell")
strScpCmd = "scp -P 4400 foo@hoge:/tmp/redmine_"+ Replace(Left(Now(),10), "/", "")+"*dump .~"
WshShell.AppActivate "send_dump"
WshShell.SendKeys strScpCmd
WScript.Sleep 10000
WshShell.SendKeys "PASSWORD~"
WScript.Sleep 1000
WshShell.SendKeys "exit~"
shota-nekoneko
猫大好きおっさん
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away