Skip to content

Instantly share code, notes, and snippets.

@tklee1975
Created May 29, 2015 07:07
Show Gist options
  • Save tklee1975/34d038ae2db511d650fc to your computer and use it in GitHub Desktop.
Save tklee1975/34d038ae2db511d650fc to your computer and use it in GitHub Desktop.
A simple script to test scp working correct by Cronjob
#!/bin/sh
TIME_FILE=/etc/temp/datetime.txt
USER=admin
REMOTE_SERVER=192.168.0.1
REMOTE_PORT=22
REMOTE_PATH=/home/admin/temp
# Make a file and then send to Lab server
date > $TIME_FILE
scp $TIME_FILE $USER@$REMOTE_SERVER:$REMOTE_PATH -p $REMOTE_PORT
echo $TIME_FILE
@tklee1975
Copy link
Author

Steps to test:

@tklee1975
Copy link
Author

Why you may use this testing script:

  • You want to create a backup process from one server to another
  • You want to make sure the "auto ssh login" working when it is called by cronjob

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