-
Notifications
You must be signed in to change notification settings - Fork 0
/
wittyPiClearOn.sh
executable file
·74 lines (55 loc) · 1.32 KB
/
wittyPiClearOn.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
[ -z $BASH ] && { exec bash "$0" "$@" || exit; }
#
#--------------------------------------
#!/bin/bash
# file: wittyPiClear.sh
#
# CLear shutdown/startup
# Note that wittyPi daemon must be
# running
#
# (C) M.A. O'Neill, Tumbling Dice 2019
#--------------------------------------
#-----------------------
# Check if root UID
#-----------------------
if [ "$(id -u)" != 0 ]; then
echo 'ERROR: script must be run with effective root UID'
exit 1
fi
#-----------------------------------------------
# Include utilities script in current directory
#-----------------------------------------------
current_dir="`dirname \"$0\"`"
current_dir="`( cd \"$current_dir\" && pwd )`"
if [ -z "$current_dir" ] ; then
exit 1
fi
. $current_dir/utilities.sh
#---------------------------------
# Check for wiringPi installation
#---------------------------------
hash gpio 2>/dev/null
if [ $? -ne 0 ]; then
echo ''
echo 'ERROR: wiringPi is not installed properly (missing "gpio" command). Quitting'
echo ''
exit
fi
#-------------------------
# Check for wittyPi board
#-------------------------
if ! is_rtc_connected ; then
echo ''
log 'ERROR: Witty Pi board is not connected? Quitting'
echo ''
exit
fi
#--------------------
# Clear startup time
#--------------------
clear_startup_time
echo ""
echo "startup time cleared"
echo ""
exit 0