forked from SimpleHomelab/AtoMiC-ToolKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-access-credentials.sh
executable file
·68 lines (57 loc) · 2.16 KB
/
app-access-credentials.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
#!/bin/bash
echo
sleep 1
if grep -q "reset.sh" "$SCRIPTPATH/$APPNAME/$APPNAME-menu.sh"; then
RESETSUPPORT="If you forgot, you may use the AtoMiC $APPTITLE password reset utility."
else
RESETSUPPORT=''
fi
echo -e "${YELLOW}Your $APPTITLE credentials are...$ENDCOLOR"
if [[ -z $UINAME ]]; then
echo -e "--->${CYAN}Username: ${RED}Incompatibility. Cannot determine username.$ENDCOLOR"
if [[ -n $APPDEFAULTUNAME ]]; then
echo -e "Try default username: $GREEN$APPDEFAULTUNAME$ENDCOLOR$RESETSUPPORT"
fi
else
echo -e "--->${CYAN}Username: $GREEN$UINAME$ENDCOLOR"
fi
if [[ -z $UIPASS ]]; then
echo -e "--->${CYAN}Password: ${RED}Incompatibility. Cannot determine password.$ENDCOLOR"
if [[ -n $APPDEFAULTPASS ]]; then
echo -e "Try default Password: $GREEN$APPDEFAULTPASS$ENDCOLOR"
fi
else
echo -e "--->${CYAN}Password: $GREEN$UIPASS$ENDCOLOR"
fi
echo
if [[ ! $APPUSESNGINX = 'YES' ]]; then
ERRORCOUNT=0
echo -e "${YELLOW}Checking $APPTITLE status...$ENDCOLOR"
if [[ -f /etc/init.d/$APPINITD ]]; then
if [[ $(sudo /etc/init.d/$APPINITD status) == *"not running"* ]]; then
echo -e "$RED$APPTITLE is currently not running and will be inaccessible.$ENDCOLOR"
echo -e "Start $APPTITLE using the following command: ${CYAN}sudo /etc/init.d/$APPINITD start$ENDCOLOR"
else
echo -e "$APPTITLE is running and accessible."
fi
else
ERRORCOUNT=$(( ERRORCOUNT + 1 ))
fi
if [[ -f /etc/systemd/system/$APPSYSTEMD ]] || \
[[ -f /lib/systemd/system/$APPSYSTEMD ]] || \
[[ -f /usr/lib/systemd/system/$APPSYSTEMD ]] || \
[[ -L /etc/systemd/system/multi-user.target.wants/$APPSYSTEMD ]] ; then
echo -e "SYSTEMD $APPSYSTEMD found.$ENDCOLOR"
STATUS=$(systemctl is-active $APPSYSTEMD)
if [[ $STATUS = 'active' ]]; then
echo -e "$APPSYSTEMD is currently: ${GREEN}$STATUS$ENDCOLOR"
else
echo -e "$APPSYSTEMD is currently: ${RED}$STATUS$ENDCOLOR"
fi
else
ERRORCOUNT=$(( ERRORCOUNT + 1 ))
fi
if [[ $ERRORCOUNT = 2 ]]; then
echo -e "${RED}No boot script found.$ENDCOLOR"
fi
fi