-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainBoot.sh
75 lines (75 loc) · 1.85 KB
/
MainBoot.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
#! /bin/bash
bootLogs(){
figlet -f standard "ShaktiMaan"
echo "Press 1 to check last login time"
echo "Press 2 to check last boot time"
echo "Press 3 to check last reboot time"
echo "Press 4 to check last shutdown time"
echo "Press 5 to get the full reboot report"
echo "Press 6 to get the full shutdown report"
echo "Press 7 to exit"
echo
echo "Your input: "
read num
if [ "$num" -eq 1 ]; then
echo "Press 1 to check the login history of a specific user"
echo "Press 2 to check the login history of all users"
echo "Your input: "
read var
if [ "$var" -eq "1" ];then
echo "Enter the user name: "
read uname
figlet -f standard "Login Report Of User:"
figlet -f standard $uname
last -f /var/log/wtmp.1 $uname| awk '{print $5 " " $6 " " $7}'
elif [ "$var" -eq "2" ];then
figlet -f standard "Login Report Of All Users:"
last -f /var/log/wtmp.1 | awk '{print $1 ": " $5 " " $6 " " $7}'
else
echo "Please enter a valid input :( "
fi
elif [ "$num" -eq 2 ];
then
echo "Last Boot time is: "
who -b
elif [ "$num" -eq 3 ];
then
echo "Last Reboot time is: "
last reboot | head -1
elif [ "$num" -eq 4 ];
then
echo "Last shutdown time is: "
last -x | grep shutdown | head -1
elif [ "$num" -eq 5 ];
then
figlet -f standard "Full Reboot Report"
last reboot
elif [ "$num" -eq 6 ];
then
figlet -f standard "Full Shutdown Report"
last -x | grep shutdown
elif [ "$num" -eq 7 ];
then
echo "Exiting ......"
exit 0
else
echo "Please enter a valid input from the above options"
fi
}
bootLogs
echo "Do you want to continue? y/n"
read cont
if [ "$cont" == "n" ] || [ "$cont" == "N" ];
then
echo "Exiting ...... :)"
fi
while [ "$cont" == "y" ] || [ "$cont" == "Y" ]
do
bootLogs
echo "Do you want to continue? y/n"
read cont
if [ "$cont" == "n" ] || [ "$cont" == "N" ];
then
echo "Exiting ...... :)"
fi
done