summaryrefslogtreecommitdiff
path: root/README.org
blob: 189d632777efa8fecfdb8b7d5c0d34f64e74e1b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
* About rsyncshot
Linux backups backup with bash, cron, rsync, and hard links. 
Inspired by http://www.mikerubel.org/computers/rsync_snapshots/
* Usage
** Simple Setup
rsyncshot installs itself. To setup, just run the following commands: 
#+begin_src sh
  wget https://raw.githubusercontent.com/cjennings/rsyncshot/main/rsyncshot
  [...examine any downloaded script before running, no matter how safe you think it is...]
  sudo bash ./rsyncshot setup
#+end_src
or simply clone this repo and run make install as root.
** Automatic Hourly/Daily/Weekly Schedule via Cron
rsyncshot will install a default schedule: 
- every hour at the top of the hour
- every day at noon
- every week on Sunday at noon

Edit the schedule with: 
#+begin_src sh
sudo crontab -e 
#+end_src
** Manual Backups
Manual backups in the terminal with two arguments: 
- TYPE is a way to group backups together. Automatic backups will have the TYPE as HOURLY, DAILY, or WEEKLY. But you can give your manual backups any TYPE you wish. 
- MAX is the maximum number of backups before the oldest gets removed. 

For instance: 
#+begin_src sh
rsyncshot manual 100
#+end_src

** Filtering
Specify which directories to backup by editing /etc/rsyncshot/includes.txt. The defaults are:
#+begin_src
  - /home
  - /etc 
  - /usr/local/bin
#+end_src
Specify what filetype patterns to exclude by editing /etc/rsyncshot/excludes.txt. The defaults are:
#+begin_src
  - *.pyc
  - *.pyo
  - *.class
  - *.elc
  - *.o
  - *.tmp
  - .cache*
#+end_src
** A Few Safeguards
- rsyncshot separates backups by the machine's name. Use one external drive to backup multiple machines without conflicts.
- rsyncshot leverages lockfiles to prevent overapping runs. A rsyncshot backup will not begin if a previous run is still in progress. 
- rsyncshot will validate the specified source directories exist before beginning the backup. 
- rsyncshot validates it's backing up to a mounted drive. If the drive isn't mounted, rsyncshot attempts to mount it. 
- Backup directory permissions are changed to read-only to avoid mistaken deletion.
- rsyncshot logs the details of all runs to /var/log/rsyncshot.log. 
** Requirements
- Bash
- Cron
- Rsync
- Grep
- Flock
** Uninstalling
- run 'sudo make uninstall' from the cloned directory.
- delete relevant cron entries as root

or become root and remove
- the /usr/local/bin/rsyncshot script
- the /etc/rsyncshot directory
- (optional) /var/log/rsyncshot.log
... and the relevant cron entries with crontab -e

* Notes
rsyncshot isn't production software, even though the underlying utilities are.