summaryrefslogtreecommitdiff
path: root/heartbeat.sh
blob: c98e7833ea93bc00231bc308ae1dff5fc7443895 (plain)
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
#!/bin/bash -

# heartbeat.sh
# SJP 9 September 2014
#
# Monitors uptime and logs it in case of shutdown
#
# Designed to be run frequently from cron

# Have we just rebooted? Don't want to overwrite!
[ -e ~/mail/monitor/data/heartlock ] && exit 1337

# get CPU temperature
cputemp=$(cat /sys/class/thermal/thermal_zone0/temp)
cputemp=$[cputemp/1000]

cat << EOF > ~/mail/monitor/data/heartbeat.txt 

Heartbeat: $(date)   CPU temperature: $cputemp
--------------------------------------
$(procinfo -Hr)

EOF