-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths76-check.sh
executable file
·60 lines (54 loc) · 2.05 KB
/
s76-check.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
#!/bin/bash
Help()
{
echo "Usage: s76-journalctl.sh <time> [options]"
echo ""
echo "options:"
echo "-h Display this message and exit."
echo "-o Order Number."
echo "-b Build Number."
echo "-s Serial Number."
}
SERIAL_NUM=""
ORDER_NUM=""
BUILD_NUM=""
while getopts ":hb:o:s:" option; do
case $option in
h) # help text
Help
exit;;
o) # Order Num
ORDER_NUM=$OPTARG;;
b) # Build Num
BUILD_NUM=$OPTARG;;
s) # Serial Num
SERIAL_NUM="_$OPTARG";;
*) # Invalid option
echo "Error: Invalid option" 1>&2
Help 1>&2
exit 1;;
esac
done
MESSAGE=""
print_failed() {
gnome-terminal --maximize -- bash -c 'echo -e "$(cat ascii/testfailed.txt)"; echo -e "$(cat ascii/guillotine.txt)"; exec bash'
}
print_passed() {
gnome-terminal --maximize -- bash -c "echo -e \"\$(cat ascii/testpassed.txt)\"; echo -e \"\$(cat ascii/surprised_pikachu.txt)\"; echo -e \"$MESSAGE\"; exec bash"
}
if [ -e "/home/$LOCAL_USER/Desktop/memtester_errors.log" ] ||
[ -e "/home/$LOCAL_USER/Desktop/journalctl${SERIAL_NUM}.log" ]; then
print_failed
exit
fi
ssh [email protected] mkdir -p "/home/system76/burn_in_logs/${ORDER_NUM}/${BUILD_NUM}"
if [ $? -eq 0 ]; then
scp "/home/${LOCAL_USER}/Desktop/burn-in_log${SERIAL_NUM}.txt" "[email protected]:/home/system76/burn_in_logs/${ORDER_NUM}/${BUILD_NUM}/"
scp -r "/home/${LOCAL_USER}/Documents/memtester/memtester_logs" "[email protected]:/home/system76/burn_in_logs/${ORDER_NUM}/${BUILD_NUM}/"
else
mkdir -p "/home/${LOCAL_USER}/Desktop/burn_in_logs/${ORDER_NUM}/${BUILD_NUM}"
cp "/home/${LOCAL_USER}/Desktop/burn-in_log${SERIAL_NUM}.txt" "/home/${LOCAL_USER}/Desktop/burn_in_logs/${ORDER_NUM}/${BUILD_NUM}/"
cp -r "/home/${LOCAL_USER}/Documents/memtester/memtester_logs" "/home/${LOCAL_USER}/Desktop/burn_in_logs/${ORDER_NUM}/${BUILD_NUM}/"
MESSAGE="Failed to connect to Burn-in Server...\nCopied Burn-in logs to Desktop."
fi
print_passed