-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathams
executable file
·1088 lines (951 loc) · 28.8 KB
/
ams
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
## Banner
function banner {
cat << EOF
█████╗ ███╗ ███╗███████╗
██╔══██╗████╗ ████║██╔════╝
███████║██╔████╔██║███████╗
██╔══██║██║╚██╔╝██║╚════██║
██║ ██║██║ ╚═╝ ██║███████║
╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
- useraid
Welcome to AutomatedMediaSrv.
For options and flags use -h or --help.
EOF
}
## Help Prompt
function vers {
echo "You are using AMS version 0.1.4."
}
function help {
cat <<EOF
This program setups a Media server that fetches and installs Movies, Shows, Automatically
using various services running as docker containers.
WARNING: Some of the functionality in this program requires root privileges. Use at
your own risk.
options:
-h|--help Display all options and flags.
--install Install ams.
-g|--graphical Run all Services, Programs and Containers.
-c|--cli Choose which services, containers and programs to Use.
(Pending Implementation)
-i|--info Display Information and Status of all running services.
-e|--edit Edit AMS configuration
-s|--status Display Status of all the services.
EOF
}
## Variables
DATA_PATH=$HOME/data
DOCKDATA_PATH=$HOME/dockdata
GUID=$(id -g)
SID=$(id -u)
TIMEZONE=$(cat /etc/timezone)
TRANUSER='admin'
TRANPASS='adminpass'
DOCINT='86400'
IPADDR=$(hostname -I | cut -d' ' -f1)
## GUI Dependencies
function gdepend {
# Installing dialog
if ! command -v dialog &> /dev/null
then
echo "Installing Dialog"
sudo apt-get -y install dialog
fi
}
## Dependencies
function installer {
sudo mv ams /usr/local/bin
echo -e "kat is now installed. \nUse kat to run commands."
}
function depend {
echo "Checking Dependencies"
# Curl
if ! command -v curl &> /dev/null
then
echo "Installing Curl"
sudo apt-get -y install curl
fi
# Docker
if ! command -v docker &> /dev/null
then
echo "Installing Docker"
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $USER
newgrp docker
fi
}
## System Upgrade
function sysup {
sudo apt update
sudo apt-get -y upgrade
}
## Install Cleanup
# function cleanup {
# rm docker.sh
# rm webhmon.sh
# sudo apt autoremove
# sudo apt autoclean
# }
## Placeholder
function placeholder {
echo -e "\nFunction yet to be implemented"
}
##########################################################################################################
######################## Services #####################################
##########################################################################################################
## Set Hostname
function hostn {
HNAME=$(dialog --title "Changing Hostname" --inputbox "Enter New Hostname" 10 100 3>&1 1>&2 2>&3)
clear
sudo hostnamectl set-hostname $HNAME
}
## Container Autoupdater
function contupdater {
DOCINT=$(dialog --title "Container Auto Update - Watchtower" --inputbox "Enter time interval to check updates" 10 100 3>&1 1>&2 2>&3)
}
### Webhook Monitoring ####################### OPTIMIZE THIS ####################
function webhmon {
WEBHOOK=$(dialog --inputbox "Enter Webhook URL" 10 100 3>&1 1>&2 2>&3)
echo '#!/bin/bash
url="$(cat webhook.txt)"
ipaddr=$(hostname -I | cut -d' ' -f1)
websites_list="http://$ipaddr:8096 http://$ipaddr:9000 http://$ipaddr:8989 http://$ipaddr:7878 http://$ipaddr:8090 http://$ipaddr:5055"
curl -H "Content-Type: application/json" -X POST -d '{"content":"'" $(date) \n***Services*** "'"}' $url
for website in ${websites_list} ; do
status_code=$(curl --write-out %{http_code} --silent --output /dev/null -L ${website})
if [[ "$status_code" -ne 200 ]] ; then
if [[ "$website" = http://*.*.*.*:8096 ]] ; then
domain="Jellyfin"
elif [[ "$website" = http://*.*.*.*:9000 ]] ; then
domain="Portainer"
elif [[ "$website" = http://*.*.*.*:8070 ]] ; then
domain="Filebrowser"
elif [[ "$website" = http://*.*.*.*:9696 ]] ; then
domain="Prowlarr"
elif [[ "$website" = http://*.*.*.*:6767 ]] ; then
domain="Bazarr"
elif [[ "$website" = http://*.*.*.*:8989 ]] ; then
domain="Sonarr"
elif [[ "$website" = http://*.*.*.*:7878 ]] ; then
domain="Radarr"
elif [[ "$website" = http://*.*.*.*:8090 ]] ; then
domain="qBittorrent"
elif [[ "$website" = http://*.*.*.*:5055 ]] ; then
domain="Jellyseerr"
fi
curl -H "Content-Type: application/json" -X POST -d '{"content":"'"${domain} is down with SC : ${status_code}"'"}' $url
else
if [[ "$website" = http://*.*.*.*:8096 ]] ; then
domain="Jellyfin"
elif [[ "$website" = http://*.*.*.*:9000 ]] ; then
domain="Portainer"
elif [[ "$website" = http://*.*.*.*:8070 ]] ; then
domain="Filebrowser"
elif [[ "$website" = http://*.*.*.*:9696 ]] ; then
domain="Prowlarr"
elif [[ "$website" = http://*.*.*.*:6767 ]] ; then
domain="Bazarr"
elif [[ "$website" = http://*.*.*.*:8989 ]] ; then
domain="Sonarr"
elif [[ "$website" = http://*.*.*.*:7878 ]] ; then
domain="Radarr"
elif [[ "$website" = http://*.*.*.*:8090 ]] ; then
domain="qBittorrent"
elif [[ "$website" = http://*.*.*.*:5055 ]] ; then
domain="Jellyseerr"
fi
curl -H "Content-Type: application/json" -X POST -d '{"content":"'"${domain} is up and running with SC : ${status_code}"'"}' $url
fi
done' >> webhmon.sh
sudo mkdir -p /etc/scripts
chmod +x webhmon.sh
echo "$WEBHOOK" >> webhook.txt
mv webhook.txt /etc/scripts/
mv webhmon.sh /etc/scripts/
clear
## Adding script to crontab
(crontab -l 2>/dev/null; echo "*/30 * * * * /etc/scripts/webhmon.sh >/dev/null 2>&1") | crontab -
}
## Status Monitoring function
function statusinfo {
# ANSI color
clear='\033[0m' # Clearing color
ipaddr=$(hostname -I | cut -d' ' -f1)
websites_list="http://$ipaddr:8096 http://$ipaddr:9000 http://$ipaddr:8070 http://$ipaddr:9696 http://$ipaddr:6767 http://$ipaddr:8989 http://$ipaddr:7878 http://$ipaddr:8090 http://$ipaddr:5055"
for website in ${websites_list} ; do
status_code=$(curl --write-out %{http_code} --silent --output /dev/null -L ${website})
if [[ "$status_code" -ne 200 ]] ; then
color='\033[0;31m' # Setting color to red.
if [[ "$website" = http://*.*.*.*:8096 ]] ; then
JFstat="Not Active"
elif [[ "$website" = http://*.*.*.*:9000 ]] ; then
PTstat="Not Active"
elif [[ "$website" = http://*.*.*.*:8070 ]] ; then
FBstat="Not Active"
elif [[ "$website" = http://*.*.*.*:9696 ]] ; then
PLstat="Not Active"
elif [[ "$website" = http://*.*.*.*:6767 ]] ; then
BZstat="Not Active"
elif [[ "$website" = http://*.*.*.*:8989 ]] ; then
SNstat="Not Active"
elif [[ "$website" = http://*.*.*.*:7878 ]] ; then
RDstat="Not Active"
elif [[ "$website" = http://*.*.*.*:8090 ]] ; then
QBstat="Not Active"
elif [[ "$website" = http://*.*.*.*:5055 ]] ; then
JSstat="Not Active"
fi
else
color='\033[0;32m' # Setting color to green.
if [[ "$website" = http://*.*.*.*:8096 ]] ; then
JFstat="Active"
elif [[ "$website" = http://*.*.*.*:9000 ]] ; then
PTstat="Active"
elif [[ "$website" = http://*.*.*.*:8070 ]] ; then
FBstat="Active"
elif [[ "$website" = http://*.*.*.*:9696 ]] ; then
PLstat="Active"
elif [[ "$website" = http://*.*.*.*:6767 ]] ; then
BZstat="Active"
elif [[ "$website" = http://*.*.*.*:8989 ]] ; then
SNstat="Active"
elif [[ "$website" = http://*.*.*.*:7878 ]] ; then
RDstat="Active"
elif [[ "$website" = http://*.*.*.*:8090 ]] ; then
QBstat="Active"
elif [[ "$website" = http://*.*.*.*:5055 ]] ; then
JSstat="Active"
fi
fi
done
# Status Output
echo -e "Jellyfin is ${color}$JFstat${clear}"
echo -e "Portainer is ${color}$PTstat${clear}"
echo -e "File Browser is ${color}$FBstat${clear}"
echo -e "Prowlarr is ${color}$PLstat${clear}"
echo -e "Bazarr is ${color}$BZstat${clear}"
echo -e "Sonarr is ${color}$SNstat${clear}"
echo -e "Radarr is ${color}$RDstat${clear}"
echo -e "qBittorrent is ${color}$QBstat${clear}"
echo -e "Jellyseerr is ${color}$JSstat${clear}"
}
## Information
function info {
clear
dialog --backtitle "Information" \
--title "Information" --msgbox "Use the following addresses for the services: \n\n \
Container Management : \n\n \
Portainer - $IPADDR:9000 \n\n \
Indexers : \n\n \
Prowlarr - $IPADDR:9696 \n \
Sonarr - $IPADDR:8989 \n \
Radarr - $IPADDR:7878 \n\n \
Webfront UI : \n\n \
Jellyfin - $IPADDR:8096 \n \
qBittorrent - $IPADDR:8090 \n\n \
Server Monitoring Dashboard : \n\n \
Cockpit - $IPADDR:9090 \n \
Webmin - $IPADDR:10000 \n\n \
Additional Services : \n\n \
Heimdall - $IPADDR:80 \n \
Filebrowser - $IPADDR:8070 \n \
Bazarr - $IPADDR:6767 \n" 20 60
clear
}
##########################################################################################################
######################## User Selection ###################################
##########################################################################################################
## No selection prompt
function nosel {
dialog \
--title "No Selection Made" --msgbox "The User choose cancel or No selection was made." 10 30
clear
}
## Services
### Indexers and ARR selection - Prowlarr, Radarr, Sonarr, Mylarr, Lidarr
function indexPack {
# Indexers and ARR selection
INDEXSEL=$(dialog --title "Choose Indexers" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Prowlarr" ON \
"2" "Sonarr" ON \
"3" "Radarr" ON 3>&1 1>&2 2>&3)
clear
}
### Docker Monitoring - Yacht, Portainer
function docmon {
# Docker Monitoring
DOCMONSEL=$(dialog --title "Choose Docker Container Manager" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Portainer" OFF \
"2" "Yacht" OFF 3>&1 1>&2 2>&3)
clear
}
### Webfront UI - Jellyfin, Jellyseerr
function webui {
# Webfront UI
WEBUISEL=$(dialog --title "Choose Web UI Services" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Jellyfin" ON \
"2" "Jellyseerr" ON 3>&1 1>&2 2>&3)
clear
}
### Download Clients - qBittorrent, Deluge, Transmission
function downui {
# Download Clients
DOWNSEL=$(dialog --title "Choose Download Client" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "qBittorrent" ON \
"2" "Deluge" OFF \
"3" "Transmission" OFF 3>&1 1>&2 2>&3)
clear
}
### Additional Services - Bazarr, Filebrowser
function addserv {
# Additional Services
ADDSERSEL=$(dialog --title "Choose Additional Services" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Bazarr" OFF \
"2" "File Browser" OFF 3>&1 1>&2 2>&3)
clear
}
### Container Updater - Watchtower
function conupdate {
# Container Updater
if dialog --yesno "Do you want to use container service that will automatically update all your containers (Watchtower) ?" 10 50; then
clear
## Watchtower
docker run -d \
--name watchtower \
-e WATCHTOWER_CLEANUP=true \
-e WATCHTOWER_POLL_INTERVAL=$DOCINT \
-v /var/run/docker.sock:/var/run/docker.sock \
--restart always \
containrrr/watchtower
else
clear
echo "Not installing Watchtower"
fi
}
### Server DashBoard - Heimdall, Organizer, Dashy
function srvdash {
# Server DashBoard
DASHSEL=$(dialog --title "Choose Server Dashboard" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Heimdall" OFF \
"2" "Organizr" OFF \
"3" "Dashy" OFF 3>&1 1>&2 2>&3)
clear
}
## Monitoring
function monitor {
# Monitoring UI
MONSEL=$(dialog --title "Choose Monitoring Services" --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Cockpit" OFF \
"2" "Webmin" OFF 3>&1 1>&2 2>&3)
clear
}
#########################################################################################################
######################## Installation ####################################
#########################################################################################################
function startinstall {
# Indexers
if [ -z "$INDEXSEL" ]; then
nosel
else
for INDEXSEL in $INDEXSEL; do
case "$INDEXSEL" in
"1")
## Prowlarr
docker run -d \
--name prowlarr \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-p 9696:9696 \
-v $DOCKDATA_PATH/prowlarr:/config \
--restart unless-stopped \
linuxserver/prowlarr:develop
;;
"2")
## Sonarr
docker run -d \
--name sonarr \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-p 8989:8989 \
-v $DOCKDATA_PATH/sonarr:/config \
-v $DATA_PATH/:/data \
-v $DOCKDATA_PATH/qbittorrent/downloads:/downloads \
--restart unless-stopped \
linuxserver/sonarr:latest
;;
"3")
## Radarr
docker run -d \
--name radarr \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-p 7878:7878 \
-v $DOCKDATA_PATH/radarr/data:/config \
-v $DATA_PATH/:/data \
-v $DOCKDATA_PATH/qbittorrent/downloads:/downloads \
--restart unless-stopped \
linuxserver/radarr:latest
;;
*)
echo "Unsupported item $INDEXSEL!" >&2
exit 1
;;
esac
done
fi
# Docker Monitoring
if [ -z "$DOCMONSEL" ]; then
clear
nosel
else
for DOCMONSEL in $DOCMONSEL; do
case "$DOCMONSEL" in
"1")
## Portainer
docker run -d \
--name portainer \
-p 9000:9000 \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
--restart=always \
portainer/portainer-ce:latest
;;
"2")
## Yacht
docker run -d \
--name yacht \
-p 8000:8000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v yacht:/config \
--restart=always \
selfhostedpro/yacht
;;
*)
echo "Unsupported item $DOCMONSEL!" >&2
exit 1
;;
esac
done
fi
# WebUI
if [ -z "$WEBUISEL" ]; then
clear
nosel
else
for WEBUISEL in $WEBUISEL; do
case "$WEBUISEL" in
"1")
## Jellyfin
docker run -d \
--name jellyfin \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-p 8096:8096 \
-p 8920:8920 \
-v $DOCKDATA_PATH/jellyfin/config:/config \
-v $DOCKDATA_PATH/jellyfin/cache:/cache \
-v $DATA_PATH/:/data \
--restart unless-stopped \
linuxserver/jellyfin:latest
;;
"2")
## Jellyseerr
docker run -d \
--name jellyseerr \
-e LOG_LEVEL=debug \
-e TZ=$TIMEZONE \
-p 5055:5055 \
-v $DOCKDATA_PATH/jellyseerr/config:/app/config \
--restart unless-stopped \
fallenbagel/jellyseerr:latest
;;
*)
echo "Unsupported item $WEBUISEL!" >&2
exit 1
;;
esac
done
fi
# Download Clients
if [ -z "$DOWNSEL" ]; then
clear
nosel
else
for DOWNSEL in $DOWNSEL; do
case "$DOWNSEL" in
"1")
## qBittorrent
docker run -d \
--name qbittorrent \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-e WEBUI_PORT=8090 \
-p 8090:8090 \
-v $DOCKDATA_PATH/qbittorrent/appdata/config:/config \
-v $DOCKDATA_PATH/qbittorrent/downloads:/downloads \
-v $DATA_PATH/data:/data \
--restart unless-stopped \
linuxserver/qbittorrent:latest
;;
"2")
## Deluge
docker run -d \
--name deluge \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-e DELUGE_LOGLEVEL=error \
-p 8112:8112 \
-v $DOCKDATA_PATH/deluge/config:/config \
-v $DOCKDATA_PATH/deluge/downloads:/downloads \
--restart unless-stopped \
linuxserver/deluge:latest
;;
"3")
## Transmission
docker run -d \
--name transmission \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-e USER=$TRANUSER \
-e PASS=$TRANPASS \
-p 9091:9091 \
-p 51413:51413 \
-p 51413:51413/udp \
-v $DOCKDATA_PATH/transmission/config:/config \
-v $DOCKDATA_PATH/transmission/downloads:/downloads \
--restart unless-stopped \
linuxserver/transmission:latest
;;
*)
echo "Unsupported item $DOWNSEL!" >&2
exit 1
;;
esac
done
fi
# Additional Services
if [ -z "$ADDSERSEL" ]; then
clear
nosel
else
for ADDSERSEL in $ADDSERSEL; do
case "$ADDSERSEL" in
"1")
## Bazarr
docker run -d \
--name bazarr \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-p 6767:6767 \
-v $DOCKDATA_PATH/bazarr/config:/config \
-v $DATA_PATH:/data \
--restart unless-stopped \
linuxserver/bazarr:latest
;;
"2")
## File Browser
### Creating DB
mkdir -p $DOCKDATA_PATH/filebrowser/
touch $DOCKDATA_PATH/filebrowser/filebrowser.db
docker run \
--name filebrowser \
-e PUID=$SID \
-e PGID=$GUID \
-p 8070:80 \
-v /:/srv \
-v $DOCKDATA_PATH/filebrowser/filebrowser.db:/database/filebrowser.db \
-v $DOCKDATA_PATH/filebrowser/settings.json:/config/settings.json \
--restart unless-stopped \
filebrowser/filebrowser:latest
;;
*)
echo "Unsupported item $ADDSERSEL!" >&2
exit 1
;;
esac
done
fi
# Server Dashboard
if [ -z "$DASHSEL" ]; then
clear
nosel
else
for DASHSEL in $DASHSEL; do
case "$DASHSEL" in
"1")
## Heimdall
docker run -d \
--name heimdall \
-e PUID=$SID \
-e PGID=$GUID \
-e TZ=$TIMEZONE \
-p 80:80 \
-p 443:443 \
-v $DOCKDATA_PATH/heimdall:/config \
--restart unless-stopped \
linuxserver/heimdall:latest
;;
"2")
## Organizr
docker run -d \
--name organizr \
-e PUID=$SID \
-e PGID=$GUID \
-v $DOCKDATA_PATH/organizr:/config \
-p 80:80 \
-e fpm="false" \
-e branch="v2-master" \
organizr/organizr
;;
"3")
## Dashy
docker run -d \
--name dashy \
-p 80:80 \
--restart=always \
lissy93/dashy:latest
;;
*)
echo "Unsupported item $DASHSEL!" >&2
exit 1
;;
esac
done
fi
# Monitoring
if [ -z "$MONSEL" ]; then
clear
nosel
else
for MONSEL in $MONSEL; do
case "$MONSEL" in
"1")
## Cockpit
. /etc/os-release
sudo apt install -t ${VERSION_CODENAME}-backports cockpit
;;
"2")
## Webmin
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.998_all.deb
sudo dpkg --install webmin_1.998_all.deb
;;
*)
echo "Unsupported item $MONSEL!" >&2
exit 1
;;
esac
done
fi
}
## Services Removal Function
############# OPTIMIZE THIS ###################
function rmserv {
# Removing Services ############# OPTIMIZE THIS ###################
RMCONT=$(dialog --title "Select Services to remove." --separate-output --checklist "Choose using SPACE and next menu using ENTER" 10 35 4 \
"1" "Heimdall" OFF \
"2" "Organizr" OFF \
"3" "Dashy" OFF \
"4" "Cockpit" OFF \
"5" "Portainer" OFF \
"6" "Webmin" OFF \
"7" "Prowlarr" OFF \
"8" "Radarr" OFF \
"9" "Sonarr" OFF \
"10" "Jellyfin" OFF \
"11" "Jellyseerr" OFF \
"12" "Watchtower" OFF \
"13" "Yacht" OFF \
"14" "qBittorrent" OFF \
"15" "Deluge" OFF \
"16" "Transmission" OFF \
"17" "Bazarr" OFF \
"18" "Filebrowser" OFF 3>&1 1>&2 2>&3)
clear
if [ -z "$RMCONT" ]; then
clear
nosel
else
for RMCONT in $RMCONT; do
case "$RMCONT" in
"1")
## Heimdall
docker stop heimdall
docker rm heimdall
;;
"2")
## Organizr
docker stop organizr
docker rm organizr
;;
"3")
## Dashy
docker stop dashy
docker rm organizr
;;
"4")
## Cockpit
sudo apt-get -y autoremove cockpit --purge
;;
"5")
## Portainer
docker stop portainer
docker rm portainer
;;
"6")
## Webmin
sudo apt-get -y --purge remove webmin
;;
"7")
## Prowlarr
docker stop prowlarr
docker rm prowlarr
;;
"8")
## Radarr
docker stop radarr
docker rm radarr
;;
"9")
## Sonarr
docker stop sonarr
docker rm sonarr
;;
"10")
## Jellyfin
docker stop jellyfin
docker rm jellyfin
;;
"11")
## Jellyseerr
docker stop jellyseerr
docker rm jellyseerr
;;
"12")
## Watchtower
docker stop watchtower
docker rm watchtower
;;
"13")
## Yacht
docker stop yacht
docker rm yacht
;;
"14")
## qBittorrent
docker stop qbittorrent
docker rm qbittorrent
;;
"15")
## Deluge
docker stop deluge
docker rm deluge
;;
"16")
## Transmission
docker stop transmission
docker rm transmission
;;
"17")
## Bazarr
docker stop bazarr
docker rm bazarr
;;
"18")
## FileBrowser
docker stop filebrowser
docker rm filebrowser
;;
*)
echo "Unsupported item $RMCONT!" >&2
exit 1
;;
esac
done
fi
}
## Install Containers Function
function instcontainers {
# Functions
## Indexers Selection
indexPack
## Docker Monitoring
docmon
## WebUI Selection
webui
## Download Client Selection
downui
## Additional Services Selection
addserv
## Services Dashboard
srvdash
## Server Monitoring Dashboard
monitor
## Container Updater
conupdate
}
#################################################################################################
######################## User Menu #####################################
#################################################################################################
## Configuration Menu
function configmenu {
CONFSEL=$(dialog --title "Configuration Menu" --menu "Choose an option" 18 100 10 \
"Change Hostname" "Change Hostname of the server." \
"Change Watchtower Interval" "Change the time interval for Watchtower- container updater." \
"Services Status" "View the status of services" \
"Webhook Monitoring" "Send status of services through webhooks." \
"Reset Ports to default" "Reset all Ports to default" \
"Exit" "Exit the Menu." 3>&1 1>&2 2>&3)
if [ -z "$CONFSEL" ]; then
nosel
else
if [[ "$CONFSEL" = "Change Watchtower Interval" ]] ; then
contupdater
elif [[ "$CONFSEL" = "Change Hostname" ]] ; then
hostn
elif [[ "$CONFSEL" = "Reset Ports to default" ]] ; then
placeholder
elif [[ "$CONFSEL" = "Services Status" ]] ; then
statusinfo
elif [[ "$CONFSEL" = "Webhook Monitoring" ]] ; then
webhmon
elif [[ "$CONFSEL" = "Exit" ]] ; then
exit
clear
fi
fi
}
## Custom Installation Menu
function custmenu {
CUSTSEL=$(dialog --title "Custom Installation" --menu "Choose an option" 18 100 10 \
"Indexers" "Choose Indexers and Aggregators. " \
"UI" "Select Frontend UI." \
"Docker Monitoring" "Select Docker monitoring service." \
"Server Monitoring Dashboard" "View information and status of server." \
"Download Clients" "Select Download Clients." \
"Additional Services" "Select Additional Services." \
"Services Dashboard" "Select services launcher dashboard." \
"Container Updater" "Install automatic container updater." \
"Exit" "Exit the Menu." 3>&1 1>&2 2>&3)
if [ -z "$CUSTSEL" ]; then
nosel
else
if [[ "$CUSTSEL" = "Indexers" ]] ; then
indexPack
elif [[ "$CUSTSEL" = "UI" ]] ; then
webui
elif [[ "$CUSTSEL" = "Docker Monitoring" ]] ; then
docmon
elif [[ "$CUSTSEL" = "Server Monitoring Dashboard" ]] ; then
monitor
elif [[ "$CUSTSEL" = "Download Clients" ]] ; then
downui
elif [[ "$CUSTSEL" = "Additional Services" ]] ; then
addserv
elif [[ "$CUSTSEL" = "Services Dashboard" ]] ; then
srvdash
elif [[ "$CUSTSEL" = "Container Updater" ]] ; then
conupdate
elif [[ "$CUSTSEL" = "Exit" ]] ; then
exit
clear
fi
fi
clear
}
## Main Menu
function mainmenu {