Skip to content

Instantly share code, notes, and snippets.

@honghuac
Last active August 10, 2021 13:15
Show Gist options
  • Save honghuac/72da9e31e4bdbfe5d1c40012db6c43dd to your computer and use it in GitHub Desktop.
Save honghuac/72da9e31e4bdbfe5d1c40012db6c43dd to your computer and use it in GitHub Desktop.
Hong's log file copy script
# Make it executable with chmod +x backup.sh
#!/bin/bash
/usr/bin/scp -r -P {REMOTEPORT} user@serveripaddress:/home/remoteuser/directory /home/localuser/directory
@honghuac
Copy link
Author

honghuac commented Aug 10, 2021

Additional instructions for using this script

  1. How to edit Crontab and execute this script as a cronjob:
    0 0 * * * /path/to/logcopy.sh > /var/log/logcopy.log 2>&1

  2. Setup passwordless login using these instructions:
    https://linuxize.com/post/how-to-setup-passwordless-ssh-login/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment