![]() |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Quote:
|
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
1 Attachment(s)
Quote:
I realised that the "range(0,11,n)" isn't /quite/ exactly the same as "range(1,12) if not i%n" as I said it was, but the new edit is how regular vixie cron actually works. This will change the behaviour slightly to use different offsets past the minute/hour/..., but still run jobs with the same gaps between overall (except perhaps the last one of a range to the next time it runs).. I also realised that with range(1,12) there's a bug as it will never be 12. range() stops before it gets to the 'end' value, its like the .end() of a c++ iterator if that means anything to you, ie. its not a value the iterator has that is real data it loops with. If you ask for range(12) you get all the values from 0 through 11 inclusive - 12 different values. Surely you (the python guys) knew this... So it needs to be range(1,13). Shoulda seen that before too. Original poster of these edits didn't test for stuff like this! The existing code will also never run at 59mins past, or the last hour of the day, or last day of the week or any last-anything'th of a range because the range is too small at the far end. Fixed in the attached patch.. I also considered including code to support the "/n" suffix for ranges rather than just "*/2" for instance, so that I could get "4-9/2" to run at 4,6,8; and could refactor the code that handles all this range stuff into one function or lambda for easier maintainability (and just pass in the range default start/end values and the string used for that value's entry), but that's for another time. If I get to it ever. Anyway, enjoy the fixes and code improvements. |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
I'm trying to add this script for E-mail sync to Alarmed but I can't seem to make it work. It's set to sync mail and then disconnect from the Internet (if GPRS).
Also, I think the script itself has some problems because if I run it in terminal I get several "if" bugs and "sleep 100" and "sleep 10" erors. Code:
#!/bin/sh |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Quote:
Then you should append the actual error messages to your post so one could help you on the point instead of guessing. Therefore all following hints are just guessed and might be wrong too. ;) Quote:
Error #2: all strings have to be enclosed by quotation marks. All not-enclosed values are treated as numbers which will obviously fail in this case. Quote:
What errors do you get concerning "sleep" command? Something like "command not found"? |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Quote:
Furthermore, here is an improved version of that script: Code:
#!/bin/sh I removed the last "Email updated" because that's basically a lie (since we don't know that modest received that dbus message - see https://bugs.maemo.org/show_bug.cgi?id=7834 ), and I can't see the point of blindly sending such a message after just waiting two minutes. |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Quote:
http://talk.maemo.org/showthread.php?t=68111 -________- |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Quote:
I like your last comment in that thread (perhaps a bit unfair but amusing) I don't understand why you handle the case where the wifi modules are unloaded - does that happen often? |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Also, do you think the dbus method actually works? There is some evidence ( https://bugs.maemo.org/show_bug.cgi?id=7834 ) that it might not.
|
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Quote:
The dbus method for checking email send/receive does work, you just have to have modest autocheck enabled (in modest options). To stop modest autocheck from interferring with alarmed email check, I found you could enable autocheck and set autocheck interval 1 year (or somthing as equally outlandish) via a gconf setting. |
Re: [Announce] "Alarmed" scheduling App (supports automatic GPRS data counter resetting)
Thanks for fixing the errors. But I still get this, when I run it:
line 32: syntax error: "fi" unexpected (expecting "then") Quote:
|
All times are GMT. The time now is 07:31. |
vBulletin® Version 3.8.8