-
Notifications
You must be signed in to change notification settings - Fork 19
/
plexdance.sh
59 lines (47 loc) · 1.87 KB
/
plexdance.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
echo "This script will perform the PLEX Dance. Hit ctrl-c to cancel"
read -p "Press Enter to continue"
echo "Stopping containers that will NOT be restarted..."
containers_stop=("tdarr" "tdarr_node" "PIC" "POR" "TitleCardMaker" "Plex-Meta-Manager")
for container in "${containers_stop[@]}"
do
docker stop "$container"
done
echo "Containers stopped"
echo "Stopping containers that will be restarted after plexdance completes..."
containers=("prowlarr" "radarr" "sonarr" "lidarr" "sabnzbd" "qbittorrent" "tautulli" "wrapperr" "PlexTraktSync")
for container in "${containers[@]}"
do
docker stop "$container"
done
echo "Containers stopped"
directories=("music" "photos" "videos" "TestVideos" "movies" "tv" "testmovie" "testtv")
for directory in "${directories[@]}"
do
chmod u+w "/mnt/user/data/media/${directory}/"
mkdir -vp "/mnt/user/data/media/${directory}_dance/"
mv "/mnt/user/data/media/${directory}/"* "/mnt/user/data/media/${directory}_dance/"
mkdir -vp "/mnt/user/data/media/${directory}/fakedir"
done
echo "tv and movies moved"
echo "1 - Go scan libraries (may be done automatically by PLEX)"
echo "2 - Empty trash on libraries"
echo "3 - Clean Bundles on libraries"
echo "4 - Wait for all activities to complete!!!"
read -p "Press enter to continue to bring back all your media"
for directory in "${directories[@]}"
do
mv "/mnt/user/data/media/${directory}_dance/"* "/mnt/user/data/media/${directory}/"
rm -rf "/mnt/user/data/media/${directory}/fakedir"
done
echo "tv and movies returned to original location."
echo "1 - Go scan libraries again (may be done automatically by PLEX)"
echo "2 - Wait for all activities to complete!!!"
read -p "Press enter to continue to restart all your containers that were stopped"
for container in "${containers[@]}"
do
docker start "$container"
done
echo "Containers restarted..."
echo "Optimize your DB"
echo "Plex Dance completed"