wordpress 用のデータをバックアップするためにExpectを使ってバックアップのためのス
クリプトを作ったので掲載。 後はcronで自動実行。
To backup wordpress data easily, I created a script with Expect and post it to
this site.
‘ install method in debian, ubuntu, raspbian
$ sudo apt-get install expect
‘script
――――from here―――――――――――――――――-
#!/usr/bin/expect
set timeout 300
spawn sudo scp -r aaa@192.168.xxx.yyy:/abc /backups/xxx
expect “aaa@192.168.xxx.yyy’s password:”
send “password\n”
expect “aaa@hostname ~ $”
spawn sudo scp -r aaa@192.168.xxx.yyy:/defg /backups/xxx
expect “aaa@192.168.xxx.yyy’s password:”
send “password\n”
expect “aaa@hostname ~ $”
spawn sudo scp -r bbb@192.168.zzz.uuu:/abc /backups/zzz
expect “bbb@192.168.zzz.uuu’s password:”
send “password2\n”
expect “bbb@hostname2 ~ $”
exit 0
――――――― until here―――――――――?
aaa, bbb, xxx, yyy, abc, defg, abc, hostname, hostname2 are
dummy just for open for public.
Leave a Comment