Skip to content

Instantly share code, notes, and snippets.

@drewdickenson
Last active June 3, 2020 17:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drewdickenson/5d5f17bdb5e7970d40c71a002b9e7fb8 to your computer and use it in GitHub Desktop.
Save drewdickenson/5d5f17bdb5e7970d40c71a002b9e7fb8 to your computer and use it in GitHub Desktop.
Sync TV and Clean TV
#################### Crontab Info #######################
0 23 * * * ~/synctv.sh
0 0 * * 7 ~/syncmov.sh
0 22 15 * * ~/cleantv.sh
0 22 16 * * ~/cleanmov.sh
##################### synctv.sh #########################
#! /bin/bash
if mountpoint -q ~/NASMedia
then
rsync --log-file=$HOME/.rsyncd.log -rltvzu /home/dd/Media/TV/ /home/dd/NASMedia/TV/
else
sudo mount -a
if mountpoint -q ~/NASMedia
then
rsync --log-file=$HOME/.rsyncd.log -rltvzu /home/dd/Media/TV/ /home/dd/NASMedia/TV/
fi
fi
################### cleantv.sh ################################
#! /bin/bash
if mountpoint -q ~/NASMedia
then
rsync --log-file=$HOME/.rsyncd.log -avz /home/dd/Media/TV/ /home/dd/NASMedia/TV/ --delete
else
sudo mount -a
if mountpoint -q ~/NASMedia
then
rsync --log-file=$HOME/.rsyncd.log -avz /home/dd/Media/TV/ /home/dd/NASMedia/TV/ --delete
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment