WardsParadox / Munki-Overnight

Run Munki Overnight (so laptops can update with lid closed) via Python and lack of NoSleep Extension.
10 stars 0 forks source link

'or' boolean expression problem? #1

Closed jmartinez0837 closed 9 years ago

jmartinez0837 commented 9 years ago

line 23 and 28 have the 'or' boolean expression, have you had any issues with that?

Im not python proficient but in my testing this logic keeps coming up with wrong results. I only need to test time so i just removed 'or' and the second 'current_time' comparison and all is well.

just wanted to see if those sections were working correctly for you

thanks

jmartinez0837 commented 9 years ago

sorry, im talking about lines 23 and 28 in overnightMunki.py

WardsParadox commented 9 years ago

I want to check my logs really quick. Let me get some more insight into this.

WardsParadox commented 9 years ago

I'm thinking I might need to change it to an and instead of or line 23. The or in line 28 runs fine on mine, but I am seeing how redundant it is now. I have two times set to test by so the and should fix this. IF time != 01 and time != 05 should execute the IF branch if the time is 02-04 and 06+. elif should be hit if it is 01 or 05 and run updates if the battery is over 50% Added to branch timedebug, take a look and see if this matches what you think.

jmartinez0837 commented 9 years ago

that sounds right.

im also testing out adding /usr/bin/caffeinate into the launchdaemon instead of having it as part of the script that way the whole script is caffeinated

    <string>/usr/bin/caffeinate -i /usr/local/etc/overnightMunki.py</string>
jmartinez0837 commented 9 years ago

i got caffeinate working from launchd

just need program arguments as follows

/usr/bin/caffeinate -i /usr/local/etc/overnightMunki.py

seems to work better this way since the whole script will run caffeinated

jmartinez0837 commented 9 years ago

that didnt show right, each of those line needs to be in a string tag

WardsParadox commented 9 years ago

Added to timedebug branch. Pushed. Will test tonight.

Zack McCauley

On Thu, Apr 2, 2015 at 9:12 AM, jmartinez0837 notifications@github.com wrote:

i got caffeinate working from launchd

just need program arguments as follows

/usr/bin/caffeinate -i /usr/local/etc/overnightMunki.py

seems to work better this way since the whole script will run caffeinated

Reply to this email directly or view it on GitHub https://github.com/WardsParadox/Munki-Overnight/issues/1#issuecomment-88940568 .

WardsParadox commented 9 years ago

Seem's to be working here. Going to push it as a 1.2.0 release. I just found a script today that I am going to incorporate into my workflow. https://gist.github.com/jacobsalmela/c045ddc4a79e5954adf2#file-pmset-py