1
1
Fork 0
My personal collection of handy scripts. Mostly bash.
Go to file
david 476269b769 added wireguard-peers.sh 2024-04-06 22:10:16 +02:00
.gitignore cleaned up scripts repo, archived old scripts to another repo 2022-04-16 20:24:26 +02:00
LICENSE updated copyright date in the LICENSE file 2023-10-03 10:12:16 +02:00
README.md testing markdown 2023-12-21 12:37:45 +01:00
btrfs-snapshots.sh fixed a bug when btrfs subvol is / (second try) 2023-10-30 15:09:51 +01:00
check-gluerecords.sh added check-gluerecords.sh 2023-10-27 11:41:00 +02:00
ci.sh ci.sh: passing on remaining command line options to ci job script 2024-01-02 22:22:24 +01:00
clone-vmdk.sh renamed a bunch of files 2023-10-27 11:40:41 +02:00
fix_macos_Home_and_End_keybinding.sh Added a script to fix mapping of macos End and Home behaviour 2023-12-12 12:00:31 +01:00
lib.sh cosmetic changes and updated README.md 2023-12-21 12:25:16 +01:00
mcapi.sh added mcapi.sh 2021-09-03 13:59:47 +02:00
odroid-fancontrol.sh renamed a bunch of files 2023-10-27 11:40:41 +02:00
request-certificate.sh renamed a bunch of files 2023-10-27 11:40:41 +02:00
restic-backup.sh corrected changelog entry for the first version in restic-backup.sh 2023-10-28 21:45:28 +02:00
restic-repos.sh renamed restic-repos.sh 2023-10-27 11:42:58 +02:00
switch-desktop.sh renamed a bunch of files 2023-10-27 11:40:41 +02:00
template.sh added template.sh 2023-10-27 11:43:07 +02:00
watch-containers.sh little fixes to v0.2.0 of watch-containers.sh 2023-10-31 22:15:45 +01:00
wireguard-peers.sh added wireguard-peers.sh 2024-04-06 22:10:16 +02:00

README.md

scripts

My personal collection of handy scripts. mostly bash.

Name Description
ci.sh A poor man's CI system
restic-backup.sh Simple wrapper script for Restic

ci.sh

Install

Clone this repository anywhere on your system and link it into your $PATH.

sudo su; cd
git clone https://git.socialnerds.org/david/scripts.git
ln -s /root/scripts/ci.sh /usr/local/bin/ci

Usage

Usage:
ci <options> <git-repo>

Options:
  -s, --scripts <DIR>  Specify the scripts directory (default: /root/ci-scripts)
  -c, --checks <URL>   Enable healthchecks.io integration
  -n, --ntfy <URL>     Enable ntfy.sh integration
  -h, --help           Print help screen and exit
  -i, --info           Print script information and exit
  -v, --verbose        More verbose output
  -q, --quiet          No output except errors (overrides -v)

restic-backup.sh

This script is my very simple take on how to perform restic backups.

Install

# Download
sudo su; cd
git clone https://git.socialnerds.org/david/scripts.git
ln -s /root/scripts/restic-backup.sh /usr/local/bin/restic-backup
# ****  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

# Usage
/root/restic_backup.sh /local/path <additional flags for the backup subcommand>

# Example
/root/restic_backup.sh /home -x -e ./.snapshots

or using cron.

# 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! :-)

restic-repos.sh

btrfs-snapshots.sh

odroid-fancontrol.sh

lib.sh

template.sh

Use this as a base for new scripts, it already has the essentials.

# Load lib.sh
SCRIPT_LIB="lib.sh"
SCRIPT_PATH=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
if [[ -r "$SCRIPT_DIR/$SCRIPT_LIB" ]]; then
  source "$SCRIPT_DIR/$SCRIPT_LIB"
  lib_print "Loading version $LIB_GREEN_BOLD$LIB_VERSION$LIB_CLEAR of $LIB_GREEN_BOLD$LIB_NAME$LIB_CLEAR"
else
  echo "Error: Cannot load library file [$SCRIPT_DIR/$SCRIPT_LIB]"
  exit 1
fi

watch-containers.sh

Simple healthchecks script to monitor running containers.

switch-desktop.sh

I think this is only useful with ElementaryOS. I use(d) this with a hot corner to control desktops with the mouse.