llutz : cron läuft
Code
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-08-22 17:58:07 CEST; 1 months 5 days ago
Docs: man:cron(8)
Main PID: 361 (cron)
Tasks: 4 (limit: 1830)
CPU: 5h 40min 47.676s
CGroup: /system.slice/cron.service
├─ 361 /usr/sbin/cron -f
├─1344751 /usr/sbin/CRON -f
├─1344753 /bin/sh -c /var/www/html/regler_auslesen.php >/dev/null
└─1344757 /usr/bin/php /var/www/html/regler_auslesen.php
Sep 27 12:15:01 solaranzeige CRON[1344754]: (pi) CMD (/home/pi/InfluxSave.sh)
Sep 27 12:15:01 solaranzeige CRON[1344753]: (root) CMD (/var/www/html/regler_auslesen.php >/dev/null)
Sep 27 12:15:01 solaranzeige CRON[1344758]: (root) CMD (/var/www/html/checkreboot.sh >/dev/null)
Sep 27 12:15:01 solaranzeige CRON[1344750]: pam_unix(cron:session): session closed for user root
Sep 27 12:15:01 solaranzeige CRON[1344749]: pam_unix(cron:session): session closed for user root
Sep 27 12:15:02 solaranzeige sSMTP[1344783]: Unable to locate mail
Sep 27 12:15:02 solaranzeige sSMTP[1344783]: Cannot open mail:25
Sep 27 12:15:02 solaranzeige cron[1344783]: sendmail: Cannot open mail:25
Sep 27 12:15:02 solaranzeige CRON[1344748]: (pi) MAIL (mailed 2090 bytes of output but got status 0x0001 from MTA
)
Sep 27 12:15:02 solaranzeige CRON[1344748]: pam_unix(cron:session): session closed for user pi
Display More
ich habe die fragliche Zeile in der Crontab vom User pi crontab -e eingetragen; dann wird sie auch ausgeführt. Aber warum?
FSC830: Ja, 21:30 wäre der nächste Zeitpunkt nach Erstellen des Eintrags in der crontab gewesen.
Rasp-Berlin : Ich bin dem Tipp gefolgt und habe ein Skript erstellt
Bash
#!/bin/bash
# Sichert die Influx Datenbank auf RS819
influxd backup -portable -database solaranzeige /backup/Solar/Datenbank
Nach Eintrag in der crontab wird das jetzt auch ausgeführt
Code
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
*/5 * * * * pi /home/pi/InfluxSave.sh
Display More
Für den Test habe ich jetzt alle 5 Minuten laufen lassen, das wird noch geändert.
Fazit: ich verstehe es nicht wirklich, warum das so ist, aber ich merke mir einfach, dass die Variante "Skript & Aufruf" in crontab offenbar besser funktioniert. (Mit der Wissenslücke kann ich leben )