Opened 11 years ago

Closed 11 years ago

#6529 closed defect (fixed)

Mythshutdown return codes not consistent

Reported by: jens_eltze@… Owned by: paulh
Priority: minor Milestone: 0.22
Component: MythTV - Mythwelcome & Mythshutdown Version: head
Severity: low Keywords:
Cc: Ticket locked: no



I am using mythwelcome and mythshutdown including the periodic daily wake-up times for my MythTV server. I tried to implement that by using mythshutdown -t for setting the next scheduled startup time and then mythshutdown --shutdown to call a script that writes the next startup time to the ACPI.

Unfortunately this does NOT work without a tweak, as the return code for int setScheduledWakeupTime() is not consistent with the return code of int setWakeupTime(QString sWakeupTime). Instead of returning an integer value it returns a boolean, and the boolean is oppposite to what is expected by the main program to shutdown properly.

Explanation: int setWakeupTime(QString sWakeupTime) returns a 1 if an error occurs or a 0 if the function was able to set the time.

int setScheduledWakeupTime() returns a true (!=0) if it was able to set a new wakeup time or a false (==0) if not setup time was set.

This is conflicting and causing problems with the integration.

Recommended Change:

int setScheduledWakeupTime(): -> remove true/false for return codes -> return 0 if it was able to set a new wakeup time -> return 1 if no scheduled wakeup time was found

So basically:

set the wakeup time for the next scheduled recording

if (!m_nextRecordingStart.isNull()) {

int m_preRollSeconds = gContext->GetNumSetting?("RecordPreRoll?"); QDateTime restarttime = m_nextRecordingStart.addSecs((-1) * m_preRollSeconds);

int add = gContext->GetNumSetting?("StartupSecsBeforeRecording?", 240); if (add) restarttime = restarttime.addSecs((-1) * add); QString wakeup_timeformat = Context->GetSetting?("WakeupTimeFormat?",


return setWakeupTime(restarttime.toString(wakeup_timeformat));

} return 1; }

Change History (3)

comment:1 Changed 11 years ago by paulh

Milestone: unknown0.22
Owner: changed from Isaac Richards to paulh
Status: newassigned
Version: unknownhead

comment:2 Changed 11 years ago by paulh

I don't think it was ever intended that mythshutdown -t should be used in place of mythshutdown -w it was added so people could roll there own scripts see the original ticket #3176. No idea why it's returning inverted return codes though so I'll fix that.

comment:3 Changed 11 years ago by paulh

Resolution: fixed
Status: assignedclosed

(In [20542]) Fix the return codes from mythshutdown -t to be more consistent with others returned by mythshutdown. Fixes #6529.

Note: See TracTickets for help on using tickets.