use bash based on env, instead of hard coding location

This commit is contained in:
2025-04-25 16:39:01 -04:00
parent 57edee63fd
commit 7e49787329
44 changed files with 52 additions and 44 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# there are a few different ways to resolve public-ip, # there are a few different ways to resolve public-ip,
# keep trying until we get a result # keep trying until we get a result
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# there are a few different ways to resolve public-ip, # there are a few different ways to resolve public-ip,
# keep trying until we get a result # keep trying until we get a result
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# quickly generate a script file which will contain all crontab tasks. # quickly generate a script file which will contain all crontab tasks.
# optionally takes filename to use, defaults to 'crontasks.sh'. # optionally takes filename to use, defaults to 'crontasks.sh'.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
quiet=false quiet=false
dryrun=false dryrun=false
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
echo "NOTE: when using in prompt (such as PS1), color escape codes" echo "NOTE: when using in prompt (such as PS1), color escape codes"
echo "should be \\[surrounded by escaped square brackets\\]" echo "should be \\[surrounded by escaped square brackets\\]"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# degrees in Celsius which we regard as too high # degrees in Celsius which we regard as too high
THERMAL_ALERT=70 THERMAL_ALERT=70
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
backupDir="$1" backupDir="$1"
backupType="$2" backupType="$2"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# prune the directory of matching files or subfolders, # prune the directory of matching files or subfolders,
# until we only have the desired number of backups remaining. # until we only have the desired number of backups remaining.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
locations="$@" locations="$@"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
locations="$@" locations="$@"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# degrees in Celsius which we regard as too high, defaults to config # degrees in Celsius which we regard as too high, defaults to config
alertLevel="$1" alertLevel="$1"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
scriptRoot="$(dirname "$0")/.." scriptRoot="$(dirname "$0")/.."
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# optionally takes a single argument of how long of a delay to take. defaults to 5 seconds. # optionally takes a single argument of how long of a delay to take. defaults to 5 seconds.
seconds=$1 seconds=$1
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
LOCATION=`dirname "$0"` LOCATION=`dirname "$0"`
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# discord colors are standard 6-digit hex, but converted to a base-10 integer # discord colors are standard 6-digit hex, but converted to a base-10 integer
# colors taken from https://xkcd.com/color/rgb/ # colors taken from https://xkcd.com/color/rgb/
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
docker ps --format='{{json .Names}}' | xargs docker inspect -f '{{range .NetworkSettings.Networks}}{{json .}}{{end}}' | jq -r '.IPAddress + " " + .Aliases[0]' docker ps --format='{{json .Names}}' | xargs docker inspect -f '{{range .NetworkSettings.Networks}}{{json .}}{{end}}' | jq -r '.IPAddress + " " + .Aliases[0]'
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# determine if show all or not, default to not # determine if show all or not, default to not
all="" all=""
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# check https status code, for domain, and lookup ip address. # check https status code, for domain, and lookup ip address.
# check-domain.sh www.example.com [example.org] # check-domain.sh www.example.com [example.org]
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
quiet=false quiet=false
while getopts 'q' flag; do while getopts 'q' flag; do
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
sort <&0 | uniq --count | sort --numeric-sort sort <&0 | uniq --count | sort --numeric-sort
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# perform a "git fetch" on each location specified (recursively), or current location if none specified. # perform a "git fetch" on each location specified (recursively), or current location if none specified.
# git will quietly ignore any git repo stored in a folder you lack permission on. # git will quietly ignore any git repo stored in a folder you lack permission on.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# the command used to initialize our subtree # the command used to initialize our subtree
#git subtree add --prefix golang-install https://github.com/canha/golang-tools-install-script.git master --squash #git subtree add --prefix golang-install https://github.com/canha/golang-tools-install-script.git master --squash
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# identify-missing.sh ./* < file_list.txt # identify-missing.sh ./* < file_list.txt
# will list all files from file/input which is not present in the given loction. # will list all files from file/input which is not present in the given loction.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
if [ -f "/var/run/reboot-required" ]; then if [ -f "/var/run/reboot-required" ]; then
echo "----- Reboot Needed ---------------------------------" echo "----- Reboot Needed ---------------------------------"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# perform a "git remote -vv" on each location specified (recursively), or current location if none specified. # perform a "git remote -vv" on each location specified (recursively), or current location if none specified.
# git will quietly ignore any git repo stored in a folder you lack permission on. # git will quietly ignore any git repo stored in a folder you lack permission on.
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# cat given files prefixed with their filenames. # cat given files prefixed with their filenames.
# named-cat.sh file1.txt file2.txt # named-cat.sh file1.txt file2.txt
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# configure basic settings, will prompt for input # configure basic settings, will prompt for input
# setup symlinks, if not installed in users bin directory # setup symlinks, if not installed in users bin directory
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
read -p "Add docker to apt sources and install docker? [y/N]: " response read -p "Add docker to apt sources and install docker? [y/N]: " response
case $response in case $response in
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# install common software, will prompt before each step # install common software, will prompt before each step
#echo "----- Use nginx straight from nginx.org -------------" #echo "----- Use nginx straight from nginx.org -------------"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
echo "----- Disable IPv6 privacy settings? in sysctl -------" echo "----- Disable IPv6 privacy settings? in sysctl -------"
read -p 'if using as a IPv6 enabled server, you probably want to turn that off? [y/N]: ' fix_tempaddr read -p 'if using as a IPv6 enabled server, you probably want to turn that off? [y/N]: ' fix_tempaddr
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# return to where we were when we started # return to where we were when we started
STARTED_IN=`pwd` STARTED_IN=`pwd`
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
echo "----- Switch to secure ssh conf ---------------------" echo "----- Switch to secure ssh conf ---------------------"
read -p 'Install the secure "sshd_config" file? [y/N]: ' secure_ssh read -p 'Install the secure "sshd_config" file? [y/N]: ' secure_ssh
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
echo 'Enter the desired new port for ssh to use, leave blank to abort.' echo 'Enter the desired new port for ssh to use, leave blank to abort.'
read -p 'change ssh to operate on a different port then normal? [<new-port-number>]: ' change_port read -p 'change ssh to operate on a different port then normal? [<new-port-number>]: ' change_port
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# make it easy for sudo calls to have access to key scripts # make it easy for sudo calls to have access to key scripts
# setup symlinks, if not installed in users bin directory # setup symlinks, if not installed in users bin directory
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
LOCATION=`realpath "$0"` LOCATION=`realpath "$0"`
LOCATION=`dirname "${LOCATION}"` LOCATION=`dirname "${LOCATION}"`
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# does not always work, when you have an IPv6 connection # does not always work, when you have an IPv6 connection
# dig +short A myip.opendns.com @resolver1.opendns.com # dig +short A myip.opendns.com @resolver1.opendns.com
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# perform a "git pull" on each location specified (recursively), or current location if none specified. # perform a "git pull" on each location specified (recursively), or current location if none specified.
# git will quietly ignore any git repo stored in a folder you lack permission on. # git will quietly ignore any git repo stored in a folder you lack permission on.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
if [ -f "/var/run/reboot-required" ]; then if [ -f "/var/run/reboot-required" ]; then
echo "----- Reboot Needed ---------------------------------" echo "----- Reboot Needed ---------------------------------"
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# run the given command, but only if it's not already running. # run the given command, but only if it's not already running.
# singleton.sh long_running_script.sh --arguments --allowed # singleton.sh long_running_script.sh --arguments --allowed
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
# speed-test-ttfb https://www.example.com/ # speed-test-ttfb https://www.example.com/
curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -s -o /dev/null "$@" curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -s -o /dev/null "$@"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# perform a "git status" on each location specified (recursively), or current location if none specified. # perform a "git status" on each location specified (recursively), or current location if none specified.
# git will quietly ignore any git repo stored in a folder you lack permission on. # git will quietly ignore any git repo stored in a folder you lack permission on.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
device="$1" device="$1"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
alertLevel="$1" alertLevel="$1"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
echo "----- APT Update ------------------------------------" echo "----- APT Update ------------------------------------"
sudo apt update -y sudo apt update -y