26 lines
745 B
Bash
Executable File
26 lines
745 B
Bash
Executable File
# shellcheck shell=ksh
|
|
# 00 */2 * * * $HOME/.alias.d/opt/sync.sh >> $HOME/.alias.d/log/sync.log
|
|
|
|
dir="$HOME/Documents/SyncDir/Profile"
|
|
# name=$(scutil --get LocalHostName)
|
|
name="evlicn"
|
|
|
|
dst="$dir/$name/"
|
|
|
|
if [ ! -d "$dst" ]; then
|
|
mkdir -p "$dst"
|
|
echo "$(date "+%Y-%m-%d %H:%M:%S")" make work dir
|
|
echo -e "\t" mkdir -p "$dst"
|
|
else
|
|
echo "$(date "+%Y-%m-%d %H:%M:%S")" work in "$dst"
|
|
fi
|
|
echo sync dist is "\"$dst\""
|
|
sync_dirs=("$HOME/.alias.d" "$HOME/.ssh" "$HOME/docker.data")
|
|
echo "$(date "+%Y-%m-%d %H:%M:%S")" sync_dirs: "${sync_dirs[@]}"
|
|
# sudo chmod -R +x "$dir"
|
|
for dir in "${sync_dirs[@]}"
|
|
do
|
|
sudo rsync -av --exclude="*.log" "$dir" "$dst"
|
|
done
|
|
echo "$(date "+%Y-%m-%d %H:%M:%S")" sync finsh save in "$dst"
|
|
echo "" |