Initial
This commit is contained in:
19
roles/base/files/system_setup/image_prep.sh
Normal file
19
roles/base/files/system_setup/image_prep.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
#### Clear log files
|
||||
find /var/log -type f -name "*log" -exec truncate -s 0 {} \;
|
||||
truncate -s 0 /var/log/*tmp
|
||||
|
||||
|
||||
#### Clear user files
|
||||
find /home -type f -name .bash_history -exec rm {} \;
|
||||
|
||||
if [ -f /root/.bash_history ]; then
|
||||
rm /root/.bash_history
|
||||
fi
|
||||
|
||||
find /home -type f -name .viminfo -exec rm {} \;
|
||||
if [ -f /root/.viminfo ]; then
|
||||
rm /root/.viminfo
|
||||
fi
|
||||
4
roles/base/files/system_setup/openssh_issue.net
Normal file
4
roles/base/files/system_setup/openssh_issue.net
Normal file
@@ -0,0 +1,4 @@
|
||||
Use of this system is private. If you are not authorized, disconnect immediately.
|
||||
Failure to comply will result in your destruction.
|
||||
|
||||
|
||||
36
roles/base/files/system_setup/pi_cpu_temp.py
Normal file
36
roles/base/files/system_setup/pi_cpu_temp.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# from:
|
||||
# https://www.pragmaticlinux.com/2020/06/check-the-raspberry-pi-cpu-temperature/
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Program to demonstrate how to obtain the current value of the CPU temperature.
|
||||
"""
|
||||
print('Current CPU temperature is {:.2f}°C.'.format(get_cpu_temp()))
|
||||
print('CPU begins throttling at 60°C, and reaches critical at 80°C.')
|
||||
|
||||
|
||||
def get_cpu_temp():
|
||||
"""
|
||||
Obtains the current value of the CPU temperature.
|
||||
:returns: Current value of the CPU temperature if successful, zero value otherwise.
|
||||
:rtype: float
|
||||
"""
|
||||
# Initialize the result.
|
||||
result = 0.0
|
||||
# The first line in this file holds the CPU temperature as an integer times 1000.
|
||||
# Read the first line and remove the newline character at the end of the string.
|
||||
with open('/sys/class/thermal/thermal_zone0/temp') as f:
|
||||
line = f.readline().strip()
|
||||
# Test if the string is an integer as expected.
|
||||
if line.isdigit():
|
||||
# Convert the string with the CPU temperature to a float in degrees Celsius.
|
||||
result = float(line) / 1000
|
||||
# Give the result back to the caller.
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user