01-26-2022, 06:30 PM
(01-26-2022, 04:48 PM)KHB49 Wrote: did some reading on the internet and did some changes…
-> chmod
-> put the line before exit in rc.local
on startup it says no module gpiozero… when it reads rc.local
pi@moode:~ $ ls -l /home/pi
total 12
drwx------ 2 pi pi 4096 Dec 29 18:57 Downloads
-rwxr-xr-x 1 root root 1546 Jun 12 2019 piano.sh
-rwxr-xr-x 1 root root 117 Dec 29 19:24 shutdown-press-simple.py
pi@moode:~ $ cat /home/pi/shutdown-press-simple.py
#!/usr/bin/env python3
from gpiozero import Button
import os
Button(26).wait_for_press()
os.system("sudo poweroff")
pi@moode:~ $ cat /etc/rc.local
#!/bin/sh -e
SQLDB=/var/local/www/db/moode-sqlite3.db
# set cpu govenor
RESULT=$(sqlite3 $SQLDB "select value from cfg_system where param='cpugov'")
echo "$RESULT" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/usr/bin/udisks-glue > /dev/null 2>&1
/var/www/command/worker.php > /dev/null 2>&1
/home/pi/shutdown-press-simple.py &
exit 0