Some useful bash scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Samuel Philipp c395134a75 extended update-notify.sh to send a notification if a reboot is needed 2 months ago
.gitignore added scripts and setup.sh 10 months ago
LICENSE Initial commit 10 months ago
README.md improved docs 2 months ago
docker-compose-up-all.sh improved docker-compose-up-all.sh 3 months ago
docker-stack-deploy-all.sh updated docker-compose-up-all.sh 4 months ago
healthcheck.sh added scripts and setup.sh 10 months ago
login-notify.sh updated login-notify.sh 5 months ago
node_dir_size_exporter.sh added update-notify.sh 2 months ago
setup.sh updated setup.sh and README.md 9 months ago
update-notify.sh extended update-notify.sh to send a notification if a reboot is needed 2 months ago
validate-remote-backup.sh added scripts and setup.sh 10 months ago

README.md

awesome-scripts

Some useful bash scripts.

Content

Script Description
healthcheck.sh Script to use as cron wrap to monitor the job with health.sp-codes.de
login-notify.sh Script to send an alert on ssh login
validate-remote-backup.sh Script to validate server side rsync command to use ssh force command
docker-compose-up-all.sh Script to call docker-compose up -d on all subdirectories
docker-stack-deploy-all.sh Script to call docker stack deploy on all subdirectories
node_dir_size_exporter.sh Script to call du on a given directory to export the size to prometheus
update-notify.sh Script to call apt to check the host for new updates and notify in gotify

Setup

To set up all scripts in the current directory run this:

curl https://git.sp-codes.de/samuel-p/awesome-scripts/raw/branch/master/setup.sh | bash -s healthcheck.sh login-notify.sh validate-remote-backup.sh docker-compose-up-all.sh docker-stack-deploy-all.sh node_dir_size_exporter.sh update-notify.sh

Usage

healthcheck.sh

Just use it like this in a cronjob:

0 0 * * * /root/healthcheck.sh 333a77a4-a63e-4885-a045-d52a4f6a3d2f /root/backup.sh > /root/log/last-backup.log 2>&1

The first parameter is the healthcheck uuid instead of the script file you can als pass the command to execute directly after the uuid. The pipe to put all output to a log file is also optional.

login-notify.sh

Place a .gotify file in the same direction as the script and put the application token in. Append the following line to /etc/pam.d/sshd:

session optional pam_exec.so seteuid /path/to/login-notify.sh