Skip to content

Instantly share code, notes, and snippets.

@MorphyDK
MorphyDK / plex-healthcheck.sh
Last active September 1, 2026 09:53
Plex Media Server Healthcheck & Auto-Recovery Script
#!/bin/bash
# ==============================================================================
# Plex Media Server Healthcheck & Auto-Recovery Script
# ==============================================================================
#
# Author: MorphyDK
# GitHub: https://github.com/MorphyDK
# Repository: Plex-Healthcheck-AutoRecovery
# License: MIT
#
@MorphyDK
MorphyDK / vpn-gateway-rebuild.sh
Last active January 31, 2026 11:08
VPN Gateway setup for WG and Tun0 setup for i.e. Ubuntu Desktop ( with VPN App client )
#!/bin/bash
### CONFIG ###
# Change your LAN CARD according to your own system, in my case its ens18.
# Build for Ubuntu Desktop and testet for Ubuntu 24.04
# WEB_IP = Add your ip of the client that need to use the this server as gateway.
# Script is acting as gateway where ports are being transfered directly on to the client via TorGuard.
# Script includes a kill switch. If VPN dies - the gateway is lost to the client. No internet.
set -e
LAN_IF="ens18"
@MorphyDK
MorphyDK / vpn-watchdog.sh
Created April 23, 2025 05:08
VPN watchdog - monitor if vpn tunnel is up.
#!/bin/bash
# Config
INTERFACE="wg0"
SERVICE="wg-quick@${INTERFACE}.service"
CHECK_INTERVAL=30
MAX_RETRIES=5
RETRY_DELAY=10
check_vpn() {
@MorphyDK
MorphyDK / clean.sh
Last active August 17, 2022 12:23
Clean for logs and old kernels
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@MorphyDK
MorphyDK / sonarr.service
Created July 3, 2020 14:56
Sonarr service
[Unit]
Description=Sonarr Daemon
After=syslog.target network.target
[Service]
User=plex
Group=plex
Type=simple
ExecStart=/usr/bin/mono /opt/NzbDrone/NzbDrone.exe -nobrowser
@MorphyDK
MorphyDK / plexrestore.sh
Last active August 17, 2022 12:23
Restore your Plexmediaserver from Googledrive
#!/bin/bash
##Plexmediaserver restore
##Needs root access
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ]
then
echo "You must use root to run this script"
exit 1
fi
@MorphyDK
MorphyDK / plexbackup.sh
Last active April 30, 2022 20:36
Backup your Plexmediaserver ( incl database )
#!/bin/bash
##SCRIPT TO BACKUP YOUR ENTIRE PLEXMEDIASERVER
##Needs root access
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ]
then
echo "You must use root to run this script"
exit 1
fi
@MorphyDK
MorphyDK / Install.sh
Last active August 17, 2022 12:23
Reinstall script of your own Ubuntu server (Own passwds etc are needed to adjust the script for your needs)
#!/bin/bash
### Set UserName
echo "Ready to start"
read -rp 'UserName: ' uservar
echo "$uservar added"
#adduser $uservar && echo -e "$userPass\n$userPass\n" | passwd $uservar > /dev/null 2>&1 && echo " User account has been created." || echo " ERR -- User acount creation failed!"
adduser $uservar
usermod -aG sudo $uservar
USER=$uservar