Hallo zusammen,
ich bin immer noch blutiger Anfänger. Ich habe lange Zeit nichts mehr am Pi machen müssen.
Installiert hatte ich das damals auf Whezzy und regelmäßig updates/upgrades gefahren (neuster Stand war also Strech).
Jetzt ist leider die SD-Karte nach einem Netzausfall defekt und mein Backup ist unvollständig
Das Problem welches ich jetzt habe, hatte ich so ähnlich schon einmal (zu whezzy zeiten) und geglaubt es gelöst zu haben.
Ich habe jetzt meinen Pi3 mit Rasbian Strech neu aufgesetzt und möchte meine bewährtes Lufterskript wieder laufen lassen.
Ich habe an gpio18 einen Lüfter hängen (via Schaltung natürich).
Nach dem neuen Image und entsrechenden updates habe ich dann folgendes gemacht:
1. Unter /usr/local/bin das luefterskript.sh erstellt.
2. Unter sudo nano /etc/rc.local habe ich folgendes ergänzt:
echo "18" > /sys/class/gpio/export
Chmod 666 /sys/class/gpio/gpio18/value && sudo chmod 666 /sys/class/gpio/gpio18/direction
echo "out" > /sys/class/gpio/gpio18/direction
3. Quellcode von sudo nano luefterskript.sh ergibt:
# Temperatur 35000 = 35 C
# Einschaltschwelle
if [ `cat /sys/class/thermal/thermal_zone0/temp` -ge 55000 ];
then
echo "1" > /sys/class/gpio/gpio18/value
fi
# Ausschaltschwelle
if [ `cat /sys/class/thermal/thermal_zone0/temp` -le 45000 ];
then
echo "0" > /sys/class/gpio/gpio18/value
fi
Alles anzeigen
4. via crontab -e
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
* * * * * /usr/local/bin/luefterskript.sh
Alles anzeigen
Somit ergibt crontab -l:
pi@raspberrypi:~ $ crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
* * * * * /usr/local/bin/luefterskript.sh
Alles anzeigen
Der Befehl sudo nano /var/log/syslog ergibt:
Jun 14 17:05:01 raspberrypi CRON[1060]: (pi) CMD (/usr/local/bin/luefterskript.sh)
Jun 14 17:05:01 raspberrypi CRON[1056]: (CRON) info (No MTA installed, discarding output)
Der Befehl sudo journalctl -n 5 -u cron ergibt
pi@raspberrypi:~ $ sudo journalctl -n 5 -u cron
-- Logs begin at Thu 2016-11-03 18:16:42 CET, end at Thu 2018-06-14 18:24:15 CES
Jun 14 18:23:01 raspberrypi CRON[854]: pam_unix(cron:session): session closed fo
Jun 14 18:24:01 raspberrypi CRON[865]: pam_unix(cron:session): session opened fo
Jun 14 18:24:01 raspberrypi CRON[869]: (pi) CMD (/usr/local/bin/luefterskript.sh
Jun 14 18:24:01 raspberrypi CRON[865]: (CRON) info (No MTA installed, discarding
Jun 14 18:24:01 raspberrypi CRON[865]: pam_unix(cron:session): session closed fo
lines 1-6/6 (END)...skipping...
-- Logs begin at Thu 2016-11-03 18:16:42 CET, end at Thu 2018-06-14 18:24:15 CEST. --
Jun 14 18:23:01 raspberrypi CRON[854]: pam_unix(cron:session): session closed for user pi
Jun 14 18:24:01 raspberrypi CRON[865]: pam_unix(cron:session): session opened for user pi by (uid=0)
Jun 14 18:24:01 raspberrypi CRON[869]: (pi) CMD (/usr/local/bin/luefterskript.sh)
Jun 14 18:24:01 raspberrypi CRON[865]: (CRON) info (No MTA installed, discarding output)
Jun 14 18:24:01 raspberrypi CRON[865]: pam_unix(cron:session): session closed for user pi
Alles anzeigen
Das Skript an sich fuktioniert mit dem Befehl bash -x /usr/local/bin/luefterskript.sh
So wie ich es sehe stößt crone dieses auch an, aber es funktioniert einfach nicht automatisch...
Kann mir bitte jemand helfen? Ich stehe echt auf dem Schlauch. Mit dem alten Image hat es noch so funktioniert. Ich hatte mir das alles so notiert.....
Ich habe mich bezüglich MTA mal informiert. Ich habe ohne weiteres keine Möglichkeit eine Email zu integrieren. Muss das überhaubt sein?