diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/backup.sh | 57 | ||||
-rwxr-xr-x | scripts/once-only-nextcloud.sh | 9 | ||||
-rwxr-xr-x | scripts/single-monitor.sh | 2 | ||||
-rwxr-xr-x | scripts/sleepsort | 20 | ||||
-rwxr-xr-x | scripts/three-monitors.sh | 2 |
5 files changed, 90 insertions, 0 deletions
diff --git a/scripts/backup.sh b/scripts/backup.sh new file mode 100755 index 0000000..ce186d8 --- /dev/null +++ b/scripts/backup.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + + +# +# BorgBackup +# + +if [ ! -d ~/UTCLOUD/ ]; then + red "~/UTCLOUD not attached. Backup not started." + exit 1 +fi + +if [ ! -d ~/borgbkp/ ]; then + yellow "~/borgbkp/ repository doesn't exist. Downloading latest version from $R:borgbkp/ into ~/borgbkp" + # The initial borg repo was created with: + # $ borg init --append-only --encryption=keyfile ~/borgbkp + # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode + rsync --verbose --progress --stats --update --recursive "$R:borgbkp/" ~/borgbkp +fi + +yellow "Creating new borg archive entry" +borg create \ + --verbose \ + --stats \ + --progress \ + --compression lzma,9 \ + ~/borgbkp::'{hostname}-{now}' \ + ~/Nextcloud/ + # add folders to be backed up here +green "Done" + +yellow "Syncing ~/borgbkp to ~/UTCLOUD/borgbkp/" +rsync --verbose --progress --stats --update --recursive ~/borgbkp/ ~/UTCLOUD/borgbkp/ +green "Done" + +yellow "Syncing ~/borgbkp to $R:borgbkp/" +rsync --verbose --progress --stats --update --recursive ~/borgbkp/ "$R:borgbkp/" +green "Done" + + +# +# mr +# + +yellow "Backing up git repos" + +pushd ~/ + +mr master +mr status +mr -j16 update +mr hd +mr -j4 rsyncnet + +popd + +green "Done" diff --git a/scripts/once-only-nextcloud.sh b/scripts/once-only-nextcloud.sh new file mode 100755 index 0000000..8400080 --- /dev/null +++ b/scripts/once-only-nextcloud.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$(pidof nextcloud)" ] +then + echo "Nextcloud already running." +else + echo "Nextcloud not running yet. Starting it." + nextcloud & disown +fi diff --git a/scripts/single-monitor.sh b/scripts/single-monitor.sh new file mode 100755 index 0000000..ec6c5e2 --- /dev/null +++ b/scripts/single-monitor.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 640x1440 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output DP2 --off diff --git a/scripts/sleepsort b/scripts/sleepsort new file mode 100755 index 0000000..ea20fcb --- /dev/null +++ b/scripts/sleepsort @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Taken from: +# https://www.quora.com/What-is-the-strangest-sorting-algorithm/answer/Nipun-Ramakrishnan + +function f() { + sleep "$1" + echo "$1" +} + +while [ -n "$1" ] +do + f "$1" & + shift +done + +wait + +# example usage: +# sleepsort 5 3 6 3 6 3 1 4 7 diff --git a/scripts/three-monitors.sh b/scripts/three-monitors.sh new file mode 100755 index 0000000..d1ef7c6 --- /dev/null +++ b/scripts/three-monitors.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 640x1440 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --mode 2560x1440 --pos 0x0 --rotate normal --output DP2 --mode 2560x1440 --pos 2560x0 --rotate left |