-
Notifications
You must be signed in to change notification settings - Fork 3
/
logutil
executable file
·48 lines (41 loc) · 1.18 KB
/
logutil
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
#!/usr/bin/env bash
VERSION="0.1.0"
ROBORIO_IP="10.18.16.2"
function subcommand_fetch {
FNAME=$( ssh -q lvuser@$ROBORIO_IP "ls -rt /media/sda1/*.bag " 2>/dev/null | tail -1 )
echo "Getting $FNAME"
scp "[email protected]:"$FNAME"" .
badlogvis -o "$(basename "$FNAME")"
}
function subcommand_eraseLocal {
rm -- *.bag
rm -- *.bag.html
}
function subcommand_eraseRemote {
echo "Deleting all .bag files from lvuser@$ROBORIO_IP:~"
ssh -q lvuser@ROBORIO_IP "rm *.bag"
}
function subcommand_help {
echo "logutil version $VERSION"
echo "Author: FRC 1816 The Green Machine (https://github.com/TheGreenMachine)"
echo ""
echo "commands:"
printf "\tfetch:\t\tFetch latest bag file from RoboRIO and open in browser using badlogvis\n"
printf "\teraseLocal:\tErase all bag and bag.html files from local directory\n"
printf "\teraseRemote:\tErase all bag files from RoboRIO user home\n"
printf "\thelp:\t\tPrint this help message\n"
}
case $1 in
fetch)
subcommand_fetch
;;
eraseLocal)
subcommand_eraseLocal
;;
eraseRemote)
subcommand_eraseRemote
;;
*)
subcommand_help
;;
esac