-
Notifications
You must be signed in to change notification settings - Fork 0
/
CloudCommand.sh
164 lines (163 loc) · 5.36 KB
/
CloudCommand.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
# Cloudbox Quick Command Launcher v.0.1
figlet CloudCommand
echo -e "Choose a command from below:\e[37m"
echo
PS3='Enter Command: '
options=(
"Plex AutoScan Log"
"Cloudplow Log"
"Get Google Upload Ban Log Entry"
"NCDU /opt (excluding Plex)"
"NCDU /opt (including Plex)"
"Plex Sync Folder Size"
"Plex PhotoTranscoder Folder Size"
"Delete PhotoTranscoder Folder Contents"
"Local Media Folder Size"
"Local Download Folder Size"
"Show Certificate Information"
"Fix Plex Trash"
"Renew Necessary Certificates"
"Force Renew ALL Certificates"
"NCDU Local Mount"
"NCDU / (system) (excluding /mnt)"
"Get Plex Token"
"Update Ubuntu"
"Nench Benchmark"
"Run Plex Dupefinder"
"Run Glances"
"Cloudplow Upload"
"Update CloudCommand"
"Update Overseerr"
"Update Plex"
"Update Portainer"
"Quit"
)
select opt in "${options[@]}"
do
case $opt in
"Plex AutoScan Log")
echo -e "\e[96mLaunching Plex Autoscan Log Tail. \e[39m"
echo
tail -f /opt/plex_autoscan/plex_autoscan.log -n 30
;;
"Cloudplow Log")
echo -e "\e[96mLaunching Cloudplow Log Tail. \e[39m"
echo
tail -f /opt/cloudplow/cloudplow.log -n 30
;;
"Get Google Upload Ban Log Entry")
echo -e "\e[96mGetting last Cloudplow Google Ban Entry. \e[39m"
echo
grep "Exceeded" /opt/cloudplow/cloudplow.log | tail -1
echo
;;
"NCDU /opt (excluding Plex)")
echo -e "\e[96mLaunching NCDU (excluding Plex). \e[39m"
echo
ncdu -x /opt --exclude=/opt/plex
;;
"NCDU /opt (including Plex)")
echo -e "\e[96mLaunching NCDU (including Plex). \e[39m"
ncdu /opt
;;
"NCDU Local Mount")
echo -e "\e[96mLaunching NCDU in Local Mount. \e[39m"
ncdu "/mnt/local/"
;;
"NCDU / (system) (excluding /mnt)")
echo -e "\e[96mLaunching NCDU on system (excluding /mnt). \e[39m"
ncdu -x / --exclude=/mnt
;;
"Get Plex Token")
echo -e "\e[96mLaunching Plex Token Script. \e[39m"
/opt/scripts/plex/plex_token.sh
;;
"Local Media Folder Size")
currSize=$(sudo du -sh '/mnt/local/Media' | awk '{print $1}')
echo -e "\e[96mLocal Media Folder Size is: $currSize \e[39m"
;;
"Local Download Folder Size")
currSize=$(sudo du -sh '/mnt/local/downloads' | awk '{print $1}')
echo -e "\e[96mLocal Download Folder Size is: $currSize \e[39m"
;;
"Plex Sync Folder Size")
currSize=$(sudo du -sh '/opt/plex/Library/Application Support/Plex Media Server/Cache/Transcode' | awk '{print $1}')
echo -e "\e[96mSync Folder Size is: $currSize \e[39m"
;;
"Plex PhotoTranscoder Folder Size")
currSize=$(sudo du -sh '/opt/plex/Library/Application Support/Plex Media Server/Cache/PhotoTranscoder' | awk '{print $1}')
echo -e "\e[96mPhotoTranscoder Folder Size is: $currSize \e[39m"
;;
"Delete PhotoTranscoder Folder Contents")
oldSize=$(sudo du -sh '/opt/plex/Library/Application Support/Plex Media Server/Cache/PhotoTranscoder' | awk '{print $1}')
echo -e "\e[96mPhotoTranscoder Folder Size is: $oldSize \e[39m"
rm -rf -f /opt/plex/Library/Application\ Support/Plex\ Media\ Server/Cache/PhotoTranscoder/*
currSize=$(sudo du -sh '/opt/plex/Library/Application Support/Plex Media Server/Cache/PhotoTranscoder' | awk '{print $1}')
echo -e "\e[96mDeleted PhotoTranscoder Folder Contents, Size is now: $currSize \e[39m"
;;
"Fix Plex Trash")
echo -e "\e[96mRunning Plex Trash Fixer Script. \e[39m"
/opt/scripts/plex/plex_trash_fixer.py
;;
"Show Certificate Information")
echo -e "\e[96mLaunching Certificate Information. \e[39m"
docker exec letsencrypt /app/cert_status
;;
"Renew Necessary Certificates")
echo -e "\e[96mForcing Renew of all Necessary Cerificates. \e[39m"
docker exec letsencrypt /app/signal_le_service
;;
"Force Renew ALL Certificates")
echo -e "\e[96mForcing Renew of ALL Cerificates. \e[39m"
docker exec letsencrypt /app/cert_status
;;
"Update Ubuntu")
echo -e "\e[96mUpdating Ubuntu \e[39m"
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
sudo apt-get autoclean -y
;;
"Nench Benchmark")
echo -e "\e[96mLaunching Nench Benchmark. \e[39m"
echo
curl -s wget.racing/nench.sh | bash
;;
"Run Plex Dupefinder")
echo -e "\e[96mLaunching Plex Dupefinder. \e[39m"
echo
/opt/plex_dupefinder/plexdupes.py
;;
"Run Glances")
echo -e "\e[96mLaunching Glances. \e[39m"
echo
glances
;;
"Cloudplow Upload")
echo -e "\e[96mLaunching Cloudplow Upload. \e[39m"
echo
cloudplow upload
;;
"Update CloudCommand")
curl -H 'Cache-Control: no-cache' "https://raw.githubusercontent.com/kieronbos/CloudCommand/master/CloudCommand.sh?$(date +%s)" > /opt/scripts/CloudCommand.sh; chmod +x /opt/scripts/CloudCommand.sh
break
;;
"Update Overseerr")
echo -e "\e[96mUpdating Overseerr. \e[39m"
cd /home/seed/community/ && sudo ansible-playbook community.yml --tags overseerr
;;
"Update Plex")
echo -e "\e[96mUpdating Plex. \e[39m"
cd /home/seed/cloudbox/ && sudo ansible-playbook cloudbox.yml --tags plex
;;
"Update Portainer")
echo -e "\e[96mUpdating Portainer. \e[39m"
cd /home/seed/cloudbox/ && sudo ansible-playbook cloudbox.yml --tags portainer
;;
"Quit")
break
;;
*) echo -e "\e[96mInvalid option $REPLY \e[39m";;
esac
done