Skip to content

Instantly share code, notes, and snippets.

@zackn9ne
Created July 14, 2018 21:22
Show Gist options
  • Save zackn9ne/098d74dec292d6ae21d0d7994f621c1f to your computer and use it in GitHub Desktop.
Save zackn9ne/098d74dec292d6ae21d0d7994f621c1f to your computer and use it in GitHub Desktop.
rsync lock file
#!/bin/sh
if [ -e /cygdrive/c/Users/admin/rsyncjob.lock ]
then
echo "Rsync job already running...exiting"
exit
fi
touch /cygdrive/c/Users/admin/rsyncjob.lock
#your code in here
rsync -avzhP --rsh='ssh -p2222' user@YOURIP:~/Downloads/* ./
#delete lock file at end of your job
rm /cygdrive/c/Users/admin/rsyncjob.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment