Raspberry pi Temperatur Kontrolle Warnung

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • Ich frage wegen der fehlenden Userangabe. Aber wenn du mit crontab -e die editierst, ist das ja in Ordnung.

      Versuch doch mal die Systemcrontab mit sudo nano /etc/crontab
      und da dann
      */2 * * * * root sudo /usr/bin/python /root/localtemp.py
      Gruß Dieter
      --------------
      Alle sagten: "Das geht nicht.". Dann kam einer, der wusste das nicht, und hat's einfach gemacht.
    • Ich muss aber dazu sagen, der (oder die) crontab, der mit crontab -e bearbeitet wird ist nicht der selbe wie im /etc/crontab.

      Ich muss den erst auskommentieren.

      /etc/crontab sieht so aus:


      # /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


      # m h dom mon dow user command
      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 )
      #

      crontab -e aber so

      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
      habe SHC aufgegeben.
    • C-3po schrieb:

      Ich muss aber dazu sagen, der (oder die) crontab, der mit crontab -e bearbeitet wird ist nicht der selbe wie im /etc/crontab.
      Ja, ich dachte das hätte ich oben schon deutlich gemacht.

      C-3po schrieb:

      Ich muss den erst auskommentieren.
      Das wäre nicht unbedingt notwendig, da er ja eh nicht läuft, aber für die Übersichtlichkeit (vor allem im Systemlog) äußerst sinnvoll.
      Gruß Dieter
      --------------
      Alle sagten: "Das geht nicht.". Dann kam einer, der wusste das nicht, und hat's einfach gemacht.
    • OK,

      jetzt sag mir was ich falsch gemacht habe?

      ich bearbeite die Files über winscp mit ultraedit32.

      da wurde der cron gestartet aber nichts passierte.

      mache ich das selbe jetzt mit sudo nano /etc/crontab

      scheint es zu gehen.

      versteh ich nicht.

      sudo im cron ist drin, es geht
      ist es nicht mit bei geht es trotzdem.

      mit sudo:

      Mar 3 10:54:01 bananapi /USR/SBIN/CRON[11211]: (root) CMD (sudo /usr/bin/python /root/localtemp.py)
      Mar 3 10:54:05 bananapi /USR/SBIN/CRON[11210]: (CRON) info (No MTA installed, discarding output)

      ohne

      Mar 3 11:14:01 bananapi /USR/SBIN/CRON[13403]: (root) CMD (/usr/bin/python /root/localtemp.py)
      Mar 3 11:16:01 bananapi /USR/SBIN/CRON[13617]: (root) CMD (/usr/bin/python /root/localtemp.py)

      hmmm. egal nun geht es.

      thx
      habe SHC aufgegeben.
    • rmjspa schrieb:

      Nur mal nebenbei, cronjobs werden m.W. immer als root ausgeführt. Ein sudo sollte nicht nötig sein.
      Das stimmt natürlich. Hab ich gar nicht drüber nachgedacht. Als ich das neulich Nacht geschrieben habe, habe ich das Script immer unter pi mit sudo getestet und später einfach (vermutlich ohne nachzudenken) so in crontab reinkopiert.
      Aber wie man im Post von C-3po sieht, ist's natürlich nicht notwendig. Sofern der systemweite Cron oder der Cron vom root vewendet wird. crontab -e unter pi ausgeführt hat natürlich keine root-Rechte.
      Gruß Dieter
      --------------
      Alle sagten: "Das geht nicht.". Dann kam einer, der wusste das nicht, und hat's einfach gemacht.