z0gSh1u / hushbackup

💾 Backup your folder to another server via SFTP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hushbackup

This tool backups a certain folder as .tar archive and uploads it to another server via SFTP (SSH based) with Email notification.

demo

Download

Visit Releases to grab the binary for your machine. hushbackup is portable with only a binary file and nothing else.

Or compile yourself by checking build.cmd / build.sh.

Single Run

Execute

hushbackup-1.0-linux-amd64 config.json

Here is the guide for configuration file.

{
  "source": {
    "tarballFolder": "/home/me/important_code", // the folder you want to backup
    "tempFolder": "/mnt/hdd1/temp" // a temporary path to save .tar file of tarballFolder
  },
  "target": {
    "host": "10.1.2.3", // ip of the machine you want to upload to
    "port": "22", // SFTP port
    "username": "me", // the username to login target machine
    "password": "123456", // the corresponding password
    "saveFolder": "/mnt/hdd1/bak" // the directory to store the transferred .tar file
  },
  "notification": {
    "smtp": "smtp.qq.com", // SMTP server of sender
    "port": "465", // port of SMTP server
    "from": "123@qq.com", // sender's address
    "to": "456@qq.com", // receiver's address. keep empty to disable email notification
    "username": "123@qq.com", // sender's username, usually same as `from`
    "password": "abcdef123456" // sender's password (or authentication code)
  }
}

⚠️ The config file contains plaintext passwords, so remember to set a suitable permission.

chmod 700 config.json

Scheduled Task

We can use crontab to set up scheduled task to backup periodically.

crontab -e

# Run at everyday's 03:30.
30 3 * * * /path/to/hushbackup-1.0-linux-amd64 /path/to/config.json > /path/to/log.log

Roadmap

  • Support Public Key authentication
  • Support gzip to get .tar.gz

License

MIT

Means that I take no responsibility for any results brought by the software.

About

💾 Backup your folder to another server via SFTP

License:MIT License


Languages

Language:Go 91.7%Language:Batchfile 4.3%Language:Shell 4.1%