First commit

This commit is contained in:
Git Commiter for 96-fromsofia.net 2023-02-27 01:42:25 +00:00
commit d9c420b8e4
2 changed files with 61 additions and 0 deletions

5
README.txt Normal file
View File

@ -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

56
start-emby.sh Normal file
View File

@ -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 "************************************************"