34 lines
792 B
Bash
34 lines
792 B
Bash
#!/usr/bin/env zsh
|
|
set -x
|
|
set -e
|
|
set -o nullglob
|
|
|
|
YYYYMMDD="$(date "+%Y-%m-%d")"
|
|
DST="$HOME/_TODO/$YYYYMMDD-video-import"
|
|
RSYNCOPTS="-ah --no-inc-recursive --info=progress2"
|
|
RDST="root@las1stor1:/srv/pool.2024.04/berlin.sneak.fs.video"
|
|
|
|
function amLocalToLAS1() {
|
|
ifconfig | grep 10.100.205 | wc -l
|
|
}
|
|
|
|
function copyVideosToLAS1() {
|
|
rsync \
|
|
-ah --no-inc-recursive --info=progress2 \
|
|
"$DST"/ "$RDST"/ && \
|
|
rsync \
|
|
-ah --no-inc-recursive --info=progress2 \
|
|
--remove-source-files \
|
|
"$DST"/ "$RDST"/ && \
|
|
rm -rfv "$DST" && \
|
|
ssh root@las1stor1 "cd /srv/pool.2024.04/berlin.sneak.fs.video && chown -R nobody:nogroup ."
|
|
}
|
|
|
|
function main() {
|
|
if [[ $(amLocalToLAS1) -gt 0 ]]; then
|
|
copyVideosToLAS1
|
|
fi
|
|
}
|
|
|
|
main
|