Skip to content

Instantly share code, notes, and snippets.

@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
@MorphyDK
MorphyDK / rclonemount.service
Last active August 17, 2022 12:23
Rclone mount service file for ubuntu.
[Unit]
Description=RClone Service
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/rclone mount --allow-other --dir-cache-time 1000h --log-level INFO --log-file /home/plex/logs/rclone.log --bwlimit-file 16M Googlecrypt: /home/plex/mnt
ExecStop=/bin/fusermount -uz /home/plex/mnt
Restart=on-abort
@MorphyDK
MorphyDK / rclone-upload.sh
Last active August 17, 2022 12:23
Rclone upload script
#!/bin/bash
# RCLONE UPLOAD CRON TAB SCRIPT
# Type crontab -e and add line below (without #)
# * * * * * /home/plex/scripts/rclone-upload.cron >/dev/null 2>&1
# modify line 20 config file location
if pidof -o %PPID -x "rclone-upload.sh"; then
exit 1
fi
@MorphyDK
MorphyDK / rclone-mount-check.sh
Last active March 12, 2022 12:24
Rclone mount check script - checks if your mount is connected, if not it will demount and reconnect.
#!/bin/bash
# 1. Change paths
# 2. for mount and log file & create mountchek file.
# 3. Add to crontab -e (paste the line bellow, without # in front)
# * * * * * /home/plex/scripts/rclone-mount-check.sh >/dev/null 2>&1
# Make script executable with: chmod a+x /home/plex/scripts/rclone-mount-check.sh
LOGFILE="/home/plex/logs/rclone-mount-check.log"
RCLONEREMOTE="Googlecrypt:"
MPOINT="/home/plex/mnt"
@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 / 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 / Mergerfs.service
Last active January 3, 2023 14:48
Mergerfs service file
[Unit]
Description=Megerfs Service
Requires=rclonemount.service
After=rclonemount.service
RequiresMountsFor=/home/plex/mnt
[Service]
Type=forking
User=plex
Group=plex
@MorphyDK
MorphyDK / slet.sh
Created June 1, 2019 12:32
Slet move mappe
#!/bin/bash
#remove empty directories
find /home/plex/move/ -empty -type d -delete 2>/dev/null
@MorphyDK
MorphyDK / mergerfs.service
Last active September 19, 2020 15:53
Mergerfs.service for Ubuntu Desktop 20.04
[Unit]
Description=mergerfs mount
Requires=rclonemount.service
After=rclonemount.service
RequiresMountsFor=/home/plex/mnt
[Service]
Type=forking
ExecStart=/usr/bin/mergerfs /home/plex/move:/home/plex/mnt /home/plex/media -o rw,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff,cache.files=auto-full
KillMode=process
@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