Skip to content

Commit 960390e

Browse files
authored
Merge pull request #92 from TechPerplexed/statsmenu
Statsmenu
2 parents 4a20afb + 11d9cc0 commit 960390e

18 files changed

Lines changed: 304 additions & 54 deletions

install/install.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ if [ -d /opt/.Gooby ]; then
4444
sudo chmod +x -R /opt/Gooby/menus
4545
sudo chmod +x -R /opt/Gooby/scripts/bin
4646
sudo chmod +x -R /opt/Gooby/scripts/cron
47-
sudo rsync -a /opt/Gooby/scripts/bin/gooby /bin
47+
sudo rsync -a /opt/Gooby/scripts/bin/* /bin
4848
sudo chmod 755 /bin/gooby
49+
sudo chmod 755 /bin/rclean
50+
sudo chmod 755 /bin/rstats
51+
sudo chmod 755 /bin/syncmount
4952
fi
5053

5154
source /opt/Gooby/menus/variables.sh

install/misc/Gooby-update.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ if [[ ${REPLY} =~ ^[Yy]$ ]]; then
1818
sudo chmod +x -R /opt/Gooby/menus
1919
sudo chmod +x -R /opt/Gooby/scripts/bin
2020
sudo chmod +x -R /opt/Gooby/scripts/cron
21-
sudo rsync -a /opt/Gooby/scripts/bin/gooby /bin
21+
sudo rsync -a /opt/Gooby/scripts/bin/* /bin
2222
sudo chmod 755 /bin/gooby
23+
sudo chmod 755 /bin/rclean
24+
sudo chmod 755 /bin/rstats
25+
sudo chmod 755 /bin/syncmount
2326
fi
2427

2528
clear

install/misc/upload-trigger.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
clear
4+
5+
EXPLAINTASK
6+
7+
CONFIRMATION
8+
9+
if [[ ${REPLY} =~ ^[Yy]$ ]]; then
10+
11+
echo
12+
echo "${GREEN}This will manually trigger your uploads."
13+
echo "This process runs every 15 minutes regardless!${STD}"
14+
echo
15+
16+
source /opt/Gooby/scripts/cron/syncmount.sh
17+
18+
TASKCOMPLETE
19+
20+
else
21+
22+
CANCELTHIS
23+
24+
fi
25+
26+
PAUSE

install/server/password-change.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [[ ${REPLY} =~ ^[Yy]$ ]]; then
1818

1919
case "$choice" in
2020
u|U ) passwd ;;
21-
r|R ) echo "Coming soon" ;;
21+
r|R ) sudo passwd root ;;
2222
* ) echo "No passwords changed" ;;
2323
esac
2424

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
MENU="Check Environment"
3+
MENU="Installed Apps"
44

55
source $CONFIGS/Docker/.env
66

@@ -17,18 +17,12 @@ QUIT(){
1717

1818
show_menus() {
1919
clear
20-
echo " ${CYAN}"
20+
echo " ${LBLUE}"
2121
MENUSTART
22-
echo " Timezone: ${CYAN}$( cat /etc/timezone )${STD}"
23-
echo " Your Domain: ${CYAN}$MYDOMAIN${STD}"
24-
echo " Your Email Address: ${CYAN}$MYEMAIL${STD}"
25-
echo " Your Server IP Address: ${CYAN}$IP${STD}"
26-
echo " In app media location: ${CYAN}/Media${STD}"
27-
echo " In app download location: ${CYAN}/Downloads${STD}"
28-
echo " Gooby version: ${CYAN}$VERSION${STD}"
22+
docker ps -a --format "table {{.Status}}\t: ${LBLUE}{{.Names}}${STD}" | sort
2923
echo
3024
echo " ${WHITE}Z${STD} - EXIT to Main Menu"
31-
echo " ${CYAN}"
25+
echo " ${LBLUE}"
3226
MENUEND
3327
}
3428

install/stats/environment-check.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
MENU="Check Environment"
4+
5+
source $CONFIGS/Docker/.env
6+
7+
clear
8+
echo "Fetching your settings..."
9+
10+
# Menu Options
11+
12+
QUIT(){
13+
exit
14+
}
15+
16+
# Display menu
17+
18+
show_menus() {
19+
clear
20+
echo " ${LBLUE}"
21+
MENUSTART
22+
echo -n " OS version : ${LBLUE}" ; lsb_release -ds 2>/dev/null || cat /etc/*release 2>/dev/null | head -n1 || uname -om ; echo -n "${STD}" ; echo -n "${STD}"
23+
echo " Timezone : ${LBLUE}$( cat /etc/timezone )${STD}"
24+
echo " Domain : ${LBLUE}$MYDOMAIN${STD}"
25+
echo " Email Address : ${LBLUE}$MYEMAIL${STD}"
26+
echo " IP Address : ${LBLUE}$IP${STD}"
27+
echo " Media location : ${LBLUE}/Media${STD}"
28+
echo " Download location : ${LBLUE}/Media/Downloads${STD}"
29+
echo " Gooby version : ${LBLUE}$VERSION${STD}"
30+
echo
31+
echo " ${WHITE}Z${STD} - EXIT to Main Menu"
32+
echo " ${LBLUE}"
33+
MENUEND
34+
}
35+
36+
# Read Choices
37+
38+
read_options(){
39+
local choice
40+
read -n 1 -s -r -p "Choose option: " choice
41+
case $choice in
42+
[Zz]) QUIT ;;
43+
*) echo "${LRED}Please select a valid option${STD}" && sleep 2
44+
esac
45+
}
46+
47+
MENUFINALIZE

install/stats/traffic-view.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
MENU="Rclone Activity"
4+
5+
source /opt/Gooby/menus/variables.sh
6+
source $CONFIGS/Docker/.env
7+
8+
while true; do
9+
10+
RAW=$(rclone rc --user ${RCLONEUSERNAME} --pass ${RCLONEPASSWORD} core/stats)
11+
JRAW=$(rclone rc --user ${RCLONEUSERNAME} --pass ${RCLONEPASSWORD} job/list)
12+
SDATE=$(date -d "-$(echo ${RAW} | jq '.elapsedTime') seconds" '+%F %H:%M:%S')
13+
GIG=$(echo ${RAW} | jq '.bytes /1024/1024/1024')
14+
CHECK=$(echo ${RAW} | jq .checks)
15+
DEL=$(echo ${RAW} | jq .deletes)
16+
ERR=$(echo ${RAW} | jq .errors)
17+
FT=$(echo ${RAW} | jq .transfers)
18+
19+
TRANSFERS=$(echo ${RAW} | jq .transferring | jq length)
20+
SIZE=$(echo ${RAW} | jq '[.transferring[].size]' | jq 'add /1024/1024/1024')
21+
SPEED=$(echo ${RAW} | jq '[.transferring[].speed]' | jq 'add /1024/1024')
22+
FILES=$(echo ${RAW} | jq '[ .transferring[] | {name: .name, percent: .percentage} ]')
23+
QSIZE=$(echo ${JRAW} | jq .jobids | jq length)
24+
25+
clear
26+
27+
echo " ${LBLUE}"
28+
MENUSTART
29+
echo " Transfers Since Reboot/Cleanup"
30+
echo -----------------------------------------
31+
echo -n " Startup Time : ${LBLUE}"${SDATE}; echo "${STD}"
32+
echo -n " Data transferred : ${LBLUE}"; printf "%'.2f" ${GIG}; echo " GB${STD}"
33+
echo -n " Files transferred : ${LBLUE}"; printf "%'d\n" ${FT}; echo -n "${STD}"
34+
echo -n " Checks completed : ${LBLUE}"; printf "%'d\n" ${CHECK}; echo -n "${STD}"
35+
echo -n " Deletes performed : ${LBLUE}"; printf "%'d\n" ${DEL}; echo -n "${STD}"
36+
echo -n " Errors occurred : ${LBLUE}"; printf "%'d\n" ${ERR}; echo -n "${STD}"
37+
echo
38+
echo " Transfers Real Time"
39+
echo -----------------------------------------
40+
echo -n " Rclone Sync jobs : ${LBLUE}"; printf "%'d\n" ${QSIZE}; echo -n "${STD}"
41+
echo -n " Files in motion : ${LBLUE}"; printf "%'d\n" ${TRANSFERS}; echo -n "${STD}"
42+
echo -n " Size of files : ${LBLUE}"; printf "%'.2f" ${SIZE}; echo " GB${STD}"
43+
echo -n " Current speed : ${LBLUE}"; printf "%'.2f" ${SPEED}; echo " MB/sec${STD}"
44+
echo
45+
echo " Files transferring:"; echo ${FILES} | jq
46+
echo
47+
echo " ${WHITE}Z${STD} - EXIT to Main Menu"
48+
echo " ${LBLUE}"
49+
MENUEND
50+
51+
sleep 1
52+
53+
read -t 0.25 -N 1 input
54+
if [[ $input = "z" ]] || [[ $input = "Z" ]]; then
55+
echo
56+
break
57+
fi
58+
59+
done

menus/main.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ misc(){
2525
/opt/Gooby/menus/misc.sh
2626
}
2727

28+
stats(){
29+
/opt/Gooby/menus/stats.sh
30+
}
31+
2832
quit(){
2933
MENUVISIT
3034
exit
@@ -41,6 +45,7 @@ show_menus() {
4145
echo " ${GREEN}C${STD} - Download Applications"
4246
echo " ${GREEN}D${STD} - Other Applications"
4347
echo " ${GREEN}E${STD} - Additional Tasks"
48+
echo " ${GREEN}F${STD} - Various Statistics"
4449
echo " ${LRED}Q${STD} - QUIT $FUNCTION"
4550
echo " ${GREEN}"
4651
MENUEND
@@ -57,6 +62,7 @@ read_options(){
5762
[Cc]) download ;;
5863
[Dd]) other ;;
5964
[Ee]) misc ;;
65+
[Ff]) stats ;;
6066
[Qq]) quit ;;
6167
*) echo "${LRED}Please select a valid option${STD}" && sleep 2
6268
esac

menus/misc.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ GOOBY(){
1111
source /opt/Gooby/install/misc/${TASK}-${PERFORM}.sh
1212
}
1313

14-
CHECKENV(){
15-
PERFORM="check"
16-
TASK="environment"
14+
UPLOAD(){
15+
PERFORM="trigger"
16+
TASK="upload"
1717
source /opt/Gooby/install/misc/${TASK}-${PERFORM}.sh
1818
}
1919

@@ -46,7 +46,7 @@ show_menus() {
4646
echo " ${CYAN}"
4747
MENUSTART
4848
echo " ${CYAN}A${STD} - Update Gooby"
49-
echo " ${CYAN}B${STD} - Check Environment"
49+
echo " ${CYAN}B${STD} - Trigger Uploading"
5050
echo " ${CYAN}C${STD} - System Cleanup"
5151
echo " ${CYAN}D${STD} - Create Backup"
5252
echo " ${CYAN}E${STD} - Restore Backup"
@@ -62,7 +62,7 @@ read_options(){
6262
read -n 1 -s -r -p "Choose option: " choice
6363
case $choice in
6464
[Aa]) GOOBY ;;
65-
[Bb]) CHECKENV ;;
65+
[Bb]) UPLOAD ;;
6666
[Cc]) RCLEAN ;;
6767
[Dd]) BACKUP ;;
6868
[Ee]) RESTORE ;;

menus/stats.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
MENU="Statistics"
4+
source /opt/Gooby/menus/variables.sh
5+
6+
# Menu Options
7+
8+
CHECKENV(){
9+
PERFORM="check"
10+
TASK="environment"
11+
source /opt/Gooby/install/stats/${TASK}-${PERFORM}.sh
12+
}
13+
14+
CONTAINERS(){
15+
PERFORM="installed"
16+
TASK="apps"
17+
source /opt/Gooby/install/stats/${TASK}-${PERFORM}.sh
18+
}
19+
20+
VIEWTRAFFIC(){
21+
PERFORM="view"
22+
TASK="traffic"
23+
source /opt/Gooby/install/stats/${TASK}-${PERFORM}.sh
24+
}
25+
26+
QUIT(){
27+
exit
28+
}
29+
30+
# Display menu
31+
32+
show_menus() {
33+
clear
34+
echo " ${LBLUE}"
35+
MENUSTART
36+
echo " ${LBLUE}A${STD} - Check Environment"
37+
echo " ${LBLUE}B${STD} - Installed Apps (Containers)"
38+
echo " ${LBLUE}C${STD} - View Rclone Activity"
39+
echo " ${WHITE}Z${STD} - EXIT to Main Menu"
40+
echo " ${LBLUE}"
41+
MENUEND
42+
}
43+
44+
# Read Choices
45+
46+
read_options(){
47+
local choice
48+
read -n 1 -s -r -p "Choose option: " choice
49+
case $choice in
50+
[Aa]) CHECKENV ;;
51+
[Bb]) CONTAINERS ;;
52+
[Cc]) VIEWTRAFFIC ;;
53+
[Zz]) QUIT ;;
54+
*) echo "${LRED}Please select a valid option${STD}" && sleep 2
55+
esac
56+
}
57+
58+
MENUFINALIZE

0 commit comments

Comments
 (0)