New answers tagged

3

I tried sunwait, mentioned above, but found it to be a bit clunky. I rewrote a similar program, myself, called heliocron, with the advantages being that it is actively maintained, has clear documentation and even has prebuilt binaries that run on Raspberry Pis off the bat. A basic command might look something like: 0 2 * * * heliocron --latitude 51.4769N --...


1

Yes. At least for now you need to specify either python or python3. At some point, python a.k.a Python ver 2.7.16 may be deprecated, and removed from the Raspbian distribution. But when this will happen has been the subject of speculation for some time. For now, python is version 2, and may be determined as follows: $ python -V Python 2.7.16 This, as ...


5

You've run into a well-known limitation with cron. The question has been asked and answered here many times. This recent example highlights the two (at least two) choices you have: use cron (older, simpler) use systemd (newer, more complex) The answer to your question in the context of cron usage is this: If your script runs from the command line, but ...


0

If my understanding is correct, since you want this to occur prior to logging in (on boot) you will not have input your password to determine user/root, so i would remove the sudo in the argument. In rc.local, instead of sudo python ... & try inputting the full path to python. I had a similar issue, and this worked for me: sudo /usr/bin/python [PATH TO ...


4

I think you are missing a shebang in the beginning of your python script. Please write #!/usr/bin/env python for python2 or #!/usr/bin/env python3 for python3 as a first line of your .py file. Alternatively you can write your cronjob command as python /path/to/your/script.py (or python3) to specify directly what to use to run your script. If you put all the ...


1

I like CRON jobs but you have to think: If the program errors, it will retry and possibly error every minute. The extra wear on the SD card from log entries The slight set up time every minute (CPU cycles used to cost money when I started) Changing programs require you to stop the CRON job Debugging can be harder if the background job fails On the other ...


1

You can figure this out for yourself - you don't need our help. (And you've not given us enough to answer your question anyway!) You seem to be asking if it is more efficient to use polling, or interrupts. The answer is almost inevitably interrupts are more efficient. Of course you need to use an API that will pass these interrupts to your program.


Top 50 recent answers are included