working..
This commit is contained in:
parent
9831084ff0
commit
74c36dca7e
37
README.md
37
README.md
|
@ -1,29 +1,36 @@
|
|||
sshbackup
|
||||
=========
|
||||
#sshbackup
|
||||
|
||||
bash script which does incremental backups through ssh using rsync.
|
||||
|
||||
it is supposed to be amazingly easy to install, configure and maintain.
|
||||
|
||||
|
||||
installation/usage:
|
||||
- put the file sshbackup.sh somewhere you like to have it and run it as root.
|
||||
- root must have a sshkey to connect to remote machines.
|
||||
- first option must be the sourcefile.
|
||||
- sourcefile example can be found in sourcefile_sample.
|
||||
- logs go to /var/log/sshbackup.log
|
||||
- configure a cron job for continuous backups
|
||||
* put the file sshbackup.sh somewhere you like to have it and run it as root.
|
||||
* root must have a sshkey to connect to remote machines.
|
||||
* first option must be the sourcefile.
|
||||
* sourcefile example can be found in sourcefile sample.
|
||||
* logs go to /var/log/sshbackup.log
|
||||
* configure a cron job for continuous backups
|
||||
|
||||
in order to have mail notifications working you need your cron system be able
|
||||
to send mails with the MAILTO directive in crontab.
|
||||
the sshbackup scripts only output to stdout will be when an error occures.
|
||||
cron will send you a mail on output to stdout of a script which is run by it.
|
||||
|
||||
|
||||
|
||||
bugs/features:
|
||||
- the remote sourcepath must be able to be listed by the remote backup user
|
||||
* the remote sourcepath must be able to be listed by the remote backup user
|
||||
|
||||
|
||||
todo/wanted:
|
||||
- deploy feature (deploy required settings to remote machine)
|
||||
- better notification system (for now its just crons mail on output feature)
|
||||
- check if destination is full
|
||||
todo/wanted: (roadmap)
|
||||
* deploy feature (deploy required settings to remote machine)
|
||||
* better notification system (for now its just crons mail on output feature)
|
||||
* check if destination is full
|
||||
|
||||
|
||||
license:
|
||||
- public domain (do whatever, i'm not claiming anythinng)
|
||||
* public domain (do whatever, i'm not claiming anything)
|
||||
|
||||
|
||||
|
||||
|
|
43
sshbackup.sh
43
sshbackup.sh
|
@ -13,14 +13,15 @@
|
|||
author="david@socialnerds.org"
|
||||
version="0.2.0"
|
||||
|
||||
#default rsync options. can be overridden by config file
|
||||
options="-pogEthrzl --numeric-ids --no-motd" #--partial --progress
|
||||
#dotglob option removes bug while rsyncing folder with no visible files in it
|
||||
|
||||
#rsync options.
|
||||
options="-pogEthrzl --numeric-ids --no-motd"
|
||||
#dotglob option removes bug while rsyncing folder with no visible files in it.
|
||||
remotecmd="shopt -s dotglob; /usr/bin/sudo /usr/bin/rsync"
|
||||
localcmd="/usr/bin/rsync"
|
||||
|
||||
#where should i write the log file?
|
||||
logfile="/var/log/sshbackup.log"
|
||||
sourcefile="/etc/sshbackup.lst"
|
||||
|
||||
|
||||
|
||||
|
@ -42,11 +43,14 @@ usage()
|
|||
{
|
||||
|
||||
echo
|
||||
echo "usage: sshbackup <sourcefile>"
|
||||
echo "usage: sshbackup <options> <sourcefile>"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo " -h, --help show this message"
|
||||
echo " -v, --version show version information"
|
||||
echo " -c, --config <config file> configuration file"
|
||||
echo " -d, --deploy <remote host> deploy remote configuration"
|
||||
echo " -i, --install run initial configuration"
|
||||
echo " -h, --help show this message"
|
||||
echo " -v, --version show version information"
|
||||
echo
|
||||
|
||||
}
|
||||
|
@ -76,6 +80,31 @@ amiroot()
|
|||
|
||||
}
|
||||
|
||||
#checking local configuration
|
||||
|
||||
# - am i root?
|
||||
# - do i have a useable ssh keypair -> if not abort mission and send notification
|
||||
|
||||
|
||||
#deploy local config (initial installation)
|
||||
# - the sshbackup script must be run by root on the local "backup" machine
|
||||
# - root must have a ssh keypair without passphrase to connect to remote machines
|
||||
#ssh-keygen
|
||||
|
||||
#deploy config to remote machine (needs a remote user which is sudoer)
|
||||
# - there must be a backup user on the remote system
|
||||
|
||||
# - this backup user must have permissions to run rsync as root (sudoers)
|
||||
#backupuser ALL=(root)NOPASSWD: /usr/bin/rsync
|
||||
|
||||
# - in case there is a group a ssh user must be in the backup user needs to be added
|
||||
# - in our case there is sometimes a "sshusers" group
|
||||
|
||||
#sending mail notification
|
||||
|
||||
# - where should i get mail config from?
|
||||
|
||||
|
||||
#pulling files through ssh (actual backup process)
|
||||
sshbackup()
|
||||
{
|
||||
|
|
Reference in New Issue