This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# shellcheck disable=SC2086 | |
# | |
# DESCRIPTION: | |
# 'safely' kill processes holding file locks for a file path | |
# useful for managing mountpoints with user session state changes | |
# | |
# USAGE: | |
# $0 <file-path> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
test -z "$1" && exit 1 | |
declare -a _PGREP; _PGREP+=('pgrep') | |
test ${#1} > 15 && _PGREP+=('--full') | |
_PGREP+=('--ignore-ancestors' "$1") | |
mapfile -t _PIDS < <("${_PGREP[@]}") | |
test ${#_PIDS[@]} = 0 && exit 1 | |
_SIGNALS=(15 1 3 6 9) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# iterates through a directory and its subdirectories | |
# updating any git repositories from remote | |
# | |
set +e | |
for d in *; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requires: | |
# - restic (system package) | |
# - AWS account with SNS topic configured, S3 bucket created, and API keys created | |
# - awscli (pip) with API keys configured (aws configure) | |
# - cron implementation (system package) | |
ResticBinaryPath=`which restic` | |
AwsCliBinaryPath=`which aws` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requires: | |
# - restic (system package) | |
# - AWS account with SNS topic configured and API keys created | |
# - awscli (pip) with API keys configured (aws configure) | |
# - Backblaze B2 account with API keys | |
# - cron implementation (system package) | |
ResticBinaryPath=`which restic` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Checks a systemd controlled service for status and start failures | |
SVC_NAME='servicename' | |
COUNT_FILE='/tmp/checkservice.counter' | |
# load counter from previous checks | |
[ -f $COUNT_FILE ] && { COUNT=`cat $COUNT_FILE` ; } || { COUNT=0 ; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# maintenance | |
alias sysupgrade='yaourt -S -y -u --aur' | |
# operations | |
function gpkill () { | |
if [ $1 ] ; then | |
TargetPid=`pgrep $1` | |
echo 'Sending sigterm' | |
kill -15 $TargetPid | |
sleep 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# usage: $0 <cpu-threads> | |
# | |
# i use this script to schedule times of day when my computer is not in use can max out cpu on the miner | |
# | |
# example cron entries: | |
# 00 06 * * * /path/to/xmr-mining-scheduler.sh 3 | |
# 00 23 * * * /path/to/xmr-mining-scheduler.sh 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# migrate.sh | |
# DESCRIPTION: Parse two directories of logfiles. | |
# FUNCTION: Append new files with old ones, delete files that are small, and move new files that aren't present to the old directory. | |
# USAGE: bash migrate.sh /path/to/old_logdir /path/to/new_logdir | |
# ELABORATION: | |
# Settings | |
minlines=15 # Threshhold number of lines to delete a logfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Description: | |
# Sync files to and create lists of directory contents in a LUKS container volume and upload it to S3 | |
# Good for periodic backup jobs | |
# Supports rate limiting, encryption in transit and at rest and file path exclusions | |
## Usage: | |
# bash $0 |
NewerOlder