Closed BoldBigflank closed 6 years ago
Any errors in the log or is it just abruptly ending?
You should also be able to look in the system messages.
I get no errors when I set up a log file on the cron task, it just stops. You can see I set the pixel at 0,0 to do a "breathing" red, so I can tell it breathes for 2-3 seconds and then freezes on one brightness.
Odd I can have a look when I get a chance, not sure if the guys from Pimoroni have seen this yet.
I don't see you setting pixel 0,0, from the looks of it you skip 0,0 entirely.
Also just out another question related to the script in general.
It loops every 0.1s but only changes colours on different hours. That's 36000 iterations an hour with nothing else in between except setting one colour over and over, and the chance of it performing another action is once an hour.
Why not make it a bit more efficent and sleep for 60s or more or calculate how long to sleep for until the next hour change?
Just looking at it from a sys admin POV.
One more thing, your low red is the brightest red. Maybe you want something more like 128,0,0? I have a breathing script sitting somewhere I'll throw it over to you when I get to my pi
I set 0,0 in the while loop just before sleep. This does need to be updated often to get the "breathing" right. Besides, this is all my zero is doing, so 10 times a second is not stressing the device at all. I can optimize after it is working.
Ah, the low red is fully red, but has a low intensity. I could cut that down to make it dimmer, for sure.
Ah sorry there it is! I did not see it :) On Tue, 13 Jun 2017 at 14:11, Alex Swan notifications@github.com wrote:
I set 0,0 in the while loop just before sleep. This does need to be updated often to get the "breathing" right. Besides, this is all my zero is doing, so 10 times a second is not stressing the device at all. I can optimize after it is working.
Ah, the low red is fully red, but has a low intensity. I could cut that down to make it dimmer, for sure.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/pimoroni/unicorn-hat/issues/98#issuecomment-308110501, or mute the thread https://github.com/notifications/unsubscribe-auth/AIElCklXqXmVbnJ_zvj4UhHqlLJqZB9yks5sDopsgaJpZM4N2jIg .
@BoldBigflank right so I fiddled around a for a few minutes now and it's quite simple to get it working without crashing, I found it crashing on trying to access /dev/mem so you need to change your crontab to run it with "sudo python" this way it works fine for me and does not terminate at all.
Here I've saved it as timecolour.py:
#make it run at a specific time every day -> 9:15pm
15 21 * * * sudo python ~/scripts/timecolour.py 1>~/scripts/timecolour.log 2>&1 &
#make it run on restart
@restart sudo python ~/scripts/timecolour.py 1>~/scripts/timecolour.log 2>&1 &
@BoldBigflank another thing to take note of is that you cannot terminate it cleanly, so if you do just "sudo kill
I had been using root's crontab, so this permissions thing doesn't seem to be the same issue I am seeing.
Try adding the extra ampersand right at the end.
I'm not with my pi again, did not think to try it with root. What if you do it as a normal user with sudo?
I tried setting up the crontab like you suggested but with the example rainbow.py with the same result, 2-5 seconds of animation then frozen.
And what about if you run it as a normal user with sudo, does that do the same or does it work?
On Wed, 14 Jun 2017 at 14:21, Alex Swan notifications@github.com wrote:
I tried setting up the crontab like you suggested but with the example rainbow.py with the same result, 2-5 seconds of animation then frozen.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/pimoroni/unicorn-hat/issues/98#issuecomment-308428928, or mute the thread https://github.com/notifications/unsubscribe-auth/AIElCpjs6eKfmyNnpxPvpKnHBnWLr3b5ks5sD95YgaJpZM4N2jIg .
The behavior is the same with sudo.
--Alex Swan www.bold-it.com
On Wed, Jun 14, 2017 at 10:52 AM, Pyroseza notifications@github.com wrote:
And what about if you run it as a normal user with sudo, does that do the same or does it work?
On Wed, 14 Jun 2017 at 14:21, Alex Swan notifications@github.com wrote:
I tried setting up the crontab like you suggested but with the example rainbow.py with the same result, 2-5 seconds of animation then frozen.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/pimoroni/unicorn-hat/issues/98# issuecomment-308428928, or mute the thread https://github.com/notifications/unsubscribe-auth/ AIElCpjs6eKfmyNnpxPvpKnHBnWLr3b5ks5sD95YgaJpZM4N2jIg .
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pimoroni/unicorn-hat/issues/98#issuecomment-308475455, or mute the thread https://github.com/notifications/unsubscribe-auth/AAm4JNjytRgR7uRcrOA5BgiCGdcF-d8Iks5sEAHZgaJpZM4N2jIg .
Okay I've tried all sorts of ways to break this but it works every time for me. You sure that there are no messages in the system log (/var/log/messages) or in your mail (/var/mail)? What python do you have installed? What shell are you using?
Did you folks ever get to the bottom of this? Sorry for not chiming in, but I had no more insight to offer!
Nope I can't replicate this, never got more info either
I made a little script that shows a different color based on the hour of the day. When I run it by hand it runs properly. When I hook it up to a crontab or put it in rc.local, it goes for a couple seconds, then stops. I'm not really sure what causes it, but I do know that both crontab and rc.local have the same effect.