NASから作業ファイル一式をダウンロードするスクリプトをデプロイする #4
|
@ -0,0 +1,16 @@
|
|||
settings {
|
||||
logfile = "/var/log/lsyncd/lsyncd.log",
|
||||
statusFile = "/var/log/lsyncd/lsyncd.status",
|
||||
statusInterval = 20,
|
||||
nodaemon = false
|
||||
}
|
||||
|
||||
sync {
|
||||
default.rsync,
|
||||
source = "/home/kazu634/works/mnt/",
|
||||
target = "kazu634@192.168.10.200:/volume1/homes/kazu634/Drive/Shared/project/",
|
||||
rsync = {
|
||||
archive = true,
|
||||
compress = true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
CONF=/etc/lsyncd/lsyncd.conf.lua
|
||||
|
||||
if [ ! -d mnt/ ]; then
|
||||
mkdir -p mnt/
|
||||
|
||||
rsync -arv kazu634@192.168.10.200:/volume1/homes/kazu634/Drive/Shared/project/ mnt/
|
||||
fi
|
||||
|
||||
if [ ! -e ${CONF} ]; then
|
||||
sudo cp ./lsyncd.conf.lua ${CONF}
|
||||
sudo chown root:root ${CONF}
|
||||
sudo chmod 644 ${CONF}
|
||||
|
||||
sudo systemctl enable lsyncd.service
|
||||
sudo systemctl restart lsyncd.service
|
||||
fi
|
||||
|
||||
exit $?
|
|
@ -79,3 +79,12 @@ remote_file '/etc/cron.d/remove_tmp' do
|
|||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Deploy `~/works/rsync.sh`:
|
||||
%w( rsync.sh lsyncd.conf.lua ).each do |file|
|
||||
remote_file "/home/kazu634/works/#{file}" do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '755'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue