commit d9c420b8e4a9ce24b3f64f80d2536ce900ed240b Author: Git Commiter for 96-fromsofia.net <2a9-7cc@96-fromsofia.net> Date: Mon Feb 27 01:42:25 2023 +0000 First commit diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..1260ce0 --- /dev/null +++ b/README.txt @@ -0,0 +1,5 @@ +DESCRIPTION: +In a scenario where one is running an emby media server and the storage is on a LUKS encrypted partition one can use the below script to automate the process of unlocking the LUKS device, mounting it setting the correct permissions and ownership for the media and starting the media server. Including some statistics information as well. + +AUTHOR: +96-fromsofia - 2A9-7CC@96-fromsofia.net || August 2021 diff --git a/start-emby.sh b/start-emby.sh new file mode 100644 index 0000000..3bba856 --- /dev/null +++ b/start-emby.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +sync +clear + +username=your_username +usergroup=your_user_group +mountpoint=/mnt +mov_dir=/mnt/movies +ser_dir=/mnt/series + +dev="$(lsblk -fs | grep -i crypto | awk '{print $1}')" +sudo cryptsetup --type luks2 open /dev/"$dev" ext +sleep 2 +sync +sudo mount /dev/mapper/ext $mountpoint +sleep 2 +sync +sudo chown $username:$usergroup $mov_dir $ser_dir -R +sudo chown 0755 $mov_dir $ser_dir -R +sleep 2 +sync +clear + +echo " " +echo "************************" +echo "Media has been mounted:" +echo "************************" +df -hT $mountpoint + +size_ser="$(du -sh $ser_dir | awk '{print $1}')" +size_mov="$(du -sh $mov_dir | awk '{print $1}')" +count_mov="$(ls -l $mov_dir | wc -l)" +count_ser="$(ls -l $ser_dir | wc -l)" + +echo " " +echo "**********" +echo "Contents:" +echo "**********" +echo "$count_mov movies in $size_mov and $count_ser tv shows in $size_ser" + +sudo systemctl start emby-server.service +sleep 2 +sync + +echo " " +echo "*********************" +echo "Emby is now running:" +echo "*********************" +systemctl status emby-server.service | grep -i active: | cut -c 4- +systemctl status emby-server.service | grep -i "main pid:" | cut -c 2- + +echo " " +echo "************************************************" +echo "The UI Accessible on http://$(hostname):9153" +echo "************************************************"