Skip to content

Instantly share code, notes, and snippets.

View RealLukeManning's full-sized avatar

Luke Manning RealLukeManning

View GitHub Profile
@RealLukeManning
RealLukeManning / check_docker_status.sh
Created March 31, 2020 23:29
Check status of Docker and attempt to restart the service it's stopped. If something goes wrong it will notify Telegram.
#!/bin/bash
# A simple bash script to check the current status of my Docker service
# If the 'rc.docker status' command returns anything other than "running" a message is sent to my Telegram bot
# The script will attempt to restart Docker and send the result to Telegram
TOKEN=""
CHAT_ID=""
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
DOCKER_STATUS_FULL="$(/etc/rc.d/rc.docker status)"
@RealLukeManning
RealLukeManning / Check_unlinked_downloads.sh
Last active March 31, 2020 23:25
Check for unlinked downloads
#!/bin/bash
# A simple shell script to check if all my downloaded items have a hardlink associated with them
# The result will be all *.mkv items that do not have more than 1 file linked to this inode
# This is primarily used in Conjunction with Sonarr and Radarr for downloaded item handling
UNLINKED_DOWNLOADS=`find /mnt/user/Media/downloads/ -type f -links 1 -iname *.mkv`
[ -z "$UNLINKED_DOWNLOADS" ] && echo "All good" || echo "$UNLINKED_DOWNLOADS
To delete all files:
find /mnt/user/Media/downloads/ -type f -links 1 -iname *.mkv -exec rm -i {} \;"
@RealLukeManning
RealLukeManning / telegram_notification.sh
Last active December 11, 2022 12:15
A small bash script for sending myself notifications from unRAID
#!/bin/bash
TOKEN=XXX
CHAT_ID=XXX
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
LIMIT=95
CACHE_LIMIT=60
#Checks how much space% is consumed on the array
ARRAY_USED_PERCENT=`df -h /mnt/user | awk '{print $5}' | sed -ne 2p | cut -d'%' -f1`
#Checks how much available space there is in GB