backupスクリプト(メモ)

#!/usr/bin/ruby

bk_target = ARGV[0]
bk_target ||= "/home/ -g nari"
bk_file = "nari_home_bk-#{Time.now.strftime("%y_%m_%d_%H_%M_%S")}"
puts bk_target
system("dar -w -c /tmp/backup_tmp -R #{bk_target}")
system("mkdir /tmp/#{bk_file}")
system("split -b 1000m /tmp/backup_tmp.1.dar /tmp/#{bk_file}/#{bk_file}.")
system("mv /tmp/#{bk_file}/ /media/HD-PSU2/backup/")
system("rm -rf /tmp/#{bk_file}/")

Cronとかに登録するとOK.
darが別途必要.