1
1
Fork 0
scripts/README.md

64 lines
1.5 KiB
Markdown
Raw Normal View History

# scripts
2020-10-21 23:05:08 +02:00
My personal collection of handy scripts. mostly bash.
2021-02-10 19:07:59 +01:00
- [restic_backup.sh](#restic_backup.sh)
2020-10-21 23:05:08 +02:00
- [setup_zsh.sh](#setup_zsh.sh)
2020-06-22 09:19:15 +02:00
2021-02-10 19:07:59 +01:00
## restic_backup.sh
> This script is my very simple take on how to perform restic backups.
2018-05-13 19:36:41 +02:00
2021-02-10 19:07:59 +01:00
First you need to download the script from this Git repository. I usually just put it in root's home.
2020-10-21 23:05:08 +02:00
```bash
2021-02-10 19:07:59 +01:00
# Download
sudo curl -o /root/restic_backup.sh https://git.socialnerds.org/david/scripts/raw/branch/main/restic_backup.sh
sudo chmod +x /root/restic_backup.sh
2018-05-13 19:36:41 +02:00
```
2020-10-21 23:05:08 +02:00
2021-02-10 19:07:59 +01:00
In the config section at the top of the script you can change various options to your liking.
2018-05-13 19:36:41 +02:00
2021-02-10 19:07:59 +01:00
```bash
# **** CONFIG ****
PASSWORD="/root/.restic-password"
REPO="sftp:<remote-server>:/path/to/repository"
KEEP=30
BIN="/usr/bin/restic"
OPTIONS="-p $PASSWORD -r $REPO -q"
```
You can run `restic_backup.sh` directly from the command line
2020-10-21 23:05:08 +02:00
2021-02-10 19:07:59 +01:00
```bash
# Usage
/root/restic_backup.sh /local/path <additional flags for the backup subcommand>
2020-10-21 23:05:08 +02:00
2021-02-10 19:07:59 +01:00
# Example
/root/restic_backup.sh /home -x -e ./.snapshots
```
2020-10-21 23:05:08 +02:00
2021-02-10 19:07:59 +01:00
or using cron.
```bash
# Cronjob
47 0 * * * /root/restic_backup.sh /home
# Cronjob (with healthchecks notification)
47 0 * * * /root/restic_backup.sh /home && curl -fsS -m 10 --retry 5 -o /dev/null https://checks.socialnerds.org/ping/fb721aec-5179-42c3-3455-4fd2ff39ii55
```
Happy backuping! :-)
2020-10-21 23:05:08 +02:00
---
2021-02-10 19:07:59 +01:00
## setup_zsh.sh
> One-line installer for zsh, oh-my-zsh and various zsh plugins.
2018-05-13 19:36:41 +02:00
2021-02-10 19:07:59 +01:00
```bash
curl -fsSL https://socialg.it/david/scripts/raw/master/setup_zsh.sh | bash
```
It is still highly experimental and will probably fail on your system.