Ticket #7762: shutdownSlaveEnhanced_v0.3+0.24.1.diff

File shutdownSlaveEnhanced_v0.3+0.24.1.diff, 20.7 KB (added by Cédric Schieli <cschieli@…>, 13 years ago)

Updated patch based on v0.3 and forwardported to the fixes/0.24 branch

  • mythtv/programs/mythbackend/encoderlink.cpp

    commit 5b97d1c0d7e32b61bbda225a17fbc621b3ca1652
    Author: Cédric Schieli <cschieli@gmail.com>
    Date:   Sun Jun 5 12:16:28 2011 +0200
    
        Ticket #7762: Autoshutdown slave feature enhanced
        
        Forwardported shutdownSlaveEnhanced_v0.3.diff to fixes/0.24 branch
        No functionnal changes, main fix was a s/gContext/gCoreContext/
    
    diff --git a/mythtv/programs/mythbackend/encoderlink.cpp b/mythtv/programs/mythbackend/encoderlink.cpp
    index da7c684..afac5f4 100644
    a b int EncoderLink::SetSignalMonitoringRate(int rate, int notifyFrontend) 
    345345
    346346/** \brief Tell a slave to go to sleep
    347347 */
    348 bool EncoderLink::GoToSleep(void)
     348int EncoderLink::GoToSleep(void)
    349349{
    350350    if (IsLocal() || !sock)
    351         return false;
     351        return -1;
    352352
    353353    lastSleepTime = QDateTime::currentDateTime();
    354354
  • mythtv/programs/mythbackend/encoderlink.h

    diff --git a/mythtv/programs/mythbackend/encoderlink.h b/mythtv/programs/mythbackend/encoderlink.h
    index 09eaae1..6d6e9c5 100644
    a b class EncoderLink 
    6464    TVRec *GetTVRec(void) { return tv; }
    6565
    6666    /// \brief Tell a slave backend to go to sleep
    67     bool GoToSleep(void);
     67    int GoToSleep(void);
    6868    int LockTuner(void);
    6969    /// \brief Unlock the tuner.
    7070    /// \sa LockTuner(), IsTunerLocked()
  • mythtv/programs/mythbackend/mainserver.cpp

    diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
    index 80e688c..77b6daa 100644
    a b void MainServer::HandleForgetRecording(QStringList &slist, PlaybackSock *pbs) 
    26082608void MainServer::HandleGoToSleep(PlaybackSock *pbs)
    26092609{
    26102610    QStringList strlist;
    2611 
    2612     QString sleepCmd = gCoreContext->GetSetting("SleepCommand");
    2613     if (!sleepCmd.isEmpty())
    2614     {
    2615         strlist << "OK";
    2616         SendResponse(pbs->getSocket(), strlist);
    2617         VERBOSE(VB_IMPORTANT, "Received GO_TO_SLEEP command from master, "
    2618                 "running SleepCommand.");
    2619         myth_system(sleepCmd);
     2611    QDateTime idleSince;
     2612    bool blockShutdown;
     2613
     2614    if (Scheduler::CheckShutdownServer(0, idleSince,  blockShutdown))
     2615    {
     2616        VERBOSE(VB_IDLE, "Received a request to shut down this machine.... response is OK.");
     2617        // sleep
     2618        QString sleep_cmd = gCoreContext->GetSetting("SleepCommand", "");
     2619 
     2620        if (!sleep_cmd.isEmpty())
     2621        {
     2622            VERBOSE(VB_GENERAL, QString("Running the command to shutdown "
     2623                        "this computer :-\n\t\t\t\t\t\t") + sleep_cmd);
     2624 
     2625            strlist << "OK";
     2626            SendResponse(pbs->getSocket(), strlist);
     2627            // and now shutdown myself
     2628            if (!myth_system(sleep_cmd))
     2629                return;
     2630            else
     2631                VERBOSE(VB_IMPORTANT, "SleepCommand failed, shutdown aborted");
     2632        }
     2633        else
     2634        {
     2635            strlist << "ERROR: SleepCommand is empty";
     2636            VERBOSE(VB_IMPORTANT, "ERROR: Slave backend should go to sleep "
     2637                "but no SleepCommand found!"); 
     2638            SendResponse(pbs->getSocket(), strlist);
     2639        }
    26202640    }
    26212641    else
    26222642    {
    2623         strlist << "ERROR: SleepCommand is empty";
    2624         VERBOSE(VB_IMPORTANT,
    2625                 "ERROR: in HandleGoToSleep(), but no SleepCommand found!");
     2643        // not allowed to sleep
     2644        VERBOSE(VB_IDLE, "Received a request to shut down this machine.... response is BUSY.");
     2645        strlist << "BUSY";
    26262646        SendResponse(pbs->getSocket(), strlist);
    26272647    }
    26282648}
  • mythtv/programs/mythbackend/playbacksock.cpp

    diff --git a/mythtv/programs/mythbackend/playbacksock.cpp b/mythtv/programs/mythbackend/playbacksock.cpp
    index 4c07cd8..0f1fe21 100644
    a b bool PlaybackSock::SendReceiveStringList( 
    144144
    145145/** \brief Tells a slave to go to sleep
    146146 */
    147 bool PlaybackSock::GoToSleep(void)
     147int PlaybackSock::GoToSleep(void)
    148148{
    149149    QStringList strlist( QString("GO_TO_SLEEP") );
    150150
    151     return SendReceiveStringList(strlist, 1) && (strlist[0] == "OK");
     151    if (SendReceiveStringList(strlist, 1)) {
     152        if (strlist[0] == "OK") 
     153            return 1;
     154        else if (strlist[0] == "BUSY")
     155            return 0;
     156    }
     157    return -1;
    152158}
    153159
    154160/**
  • mythtv/programs/mythbackend/playbacksock.h

    diff --git a/mythtv/programs/mythbackend/playbacksock.h b/mythtv/programs/mythbackend/playbacksock.h
    index c66aabf..694c55f 100644
    a b class PlaybackSock 
    5858    void setIP(QString &lip) { ip = lip; }
    5959    QString getIP(void) const { return ip; }
    6060
    61     bool GoToSleep(void);
     61    int GoToSleep(void);
    6262    void GetDiskSpace(QStringList &o_strlist);
    6363    int DeleteFile(const QString &filename, const QString &sgroup);
    6464    int StopRecording(const ProgramInfo *pginfo);
  • mythtv/programs/mythbackend/scheduler.cpp

    diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp
    index c9837fe..b2b03c6 100644
    a b void Scheduler::RunScheduler(void) 
    18741874                    }
    18751875                }
    18761876
    1877                 PutInactiveSlavesToSleep();
    1878                 lastSleepCheck = QDateTime::currentDateTime();
    1879 
    18801877                SendMythSystemEvent("SCHEDULER_RAN");
    18811878            }
    18821879        }
    void Scheduler::RunScheduler(void) 
    18881885
    18891886        curtime = QDateTime::currentDateTime();
    18901887
    1891         // About every 5 minutes check for slaves that can be put to sleep
    1892         if (lastSleepCheck.secsTo(curtime) > 300)
    1893         {
    1894             PutInactiveSlavesToSleep();
    1895             lastSleepCheck = QDateTime::currentDateTime();
    1896         }
    1897 
    18981888        // Go through the list of recordings starting in the next few minutes
    18991889        // and wakeup any slaves that are asleep
    19001890        RecIter recIter = startIter;
    void Scheduler::RunScheduler(void) 
    21962186            idleSince = QDateTime();
    21972187        }
    21982188
     2189        // About every minute check for slaves that can be waken up or put to sleep
     2190        if (lastSleepCheck.secsTo(curtime) >= 60)
     2191        {
     2192            bool slaveWaken = WakeUpSlaves(false);
     2193            if (!slaveWaken)
     2194                PutInactiveSlavesToSleep();
     2195            lastSleepCheck = QDateTime::currentDateTime();
     2196        }
     2197 
    21992198        // if idletimeout is 0, the user disabled the auto-shutdown feature
    22002199        if ((idleTimeoutSecs > 0) && (m_mainServer != NULL))
    22012200        {
    void Scheduler::ShutdownServer(int prerollseconds, QDateTime &idleSince) 
    23782377        if ((*recIter)->GetRecordingStatus() == rsWillRecord)
    23792378            break;
    23802379
    2381     // set the wakeuptime if needed
    2382     if (recIter != reclist.end())
     2380    // set the wakeuptime if needed and if we are the master
     2381    // otherwise, the master will wake up us
     2382    if (recIter != reclist.end() && gCoreContext->IsMasterBackend())
    23832383    {
    23842384        RecordingInfo *nextRecording = (*recIter);
    23852385        QDateTime restarttime = nextRecording->GetRecordingStartTime()
    void Scheduler::ShutdownServer(int prerollseconds, QDateTime &idleSince) 
    24282428        }
    24292429    }
    24302430
    2431     // tell anyone who is listening the master server is going down now
    2432     MythEvent me(QString("SHUTDOWN_NOW"));
    2433     gCoreContext->dispatch(me);
     2431    if (gCoreContext->IsMasterBackend())
     2432    {
     2433        // tell anyone who is listening the master server is going down now
     2434        MythEvent me(QString("SHUTDOWN_NOW"));
     2435        gCoreContext->dispatch(me);
     2436    }
    24342437
    24352438    QString halt_cmd = gCoreContext->GetSetting("ServerHaltCommand",
    24362439                                            "sudo /sbin/halt -p");
    void Scheduler::PutInactiveSlavesToSleep(void) 
    24812484            "Scheduler, Checking for slaves that can be shut down");
    24822485
    24832486    int sleepThreshold =
    2484         gCoreContext->GetNumSetting( "SleepThreshold", 60 * 45);
     2487        gCoreContext->GetNumSetting( "idleWaitForRecordingTime", 15) * 60;
    24852488
    24862489    VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("  Getting list of slaves that "
    24872490            "will be active in the next %1 minutes.")
    void Scheduler::PutInactiveSlavesToSleep(void) 
    24902493    VERBOSE(VB_SCHEDULE+VB_EXTRA, "Checking scheduler's reclist");
    24912494    RecIter recIter = reclist.begin();
    24922495    QDateTime curtime = QDateTime::currentDateTime();
    2493     QStringList SlavesInUse;
     2496    QStringList slavesInUse;
    24942497    for ( ; recIter != reclist.end(); ++recIter)
    24952498    {
    24962499        RecordingInfo *pginfo = *recIter;
    void Scheduler::PutInactiveSlavesToSleep(void) 
    25092512        {
    25102513            enc = (*m_tvList)[pginfo->GetCardID()];
    25112514            if ((!enc->IsLocal()) &&
    2512                 (!SlavesInUse.contains(enc->GetHostName())))
     2515                (!slavesInUse.contains(enc->GetHostName())) &&
     2516                (pginfo->GetRecordingStatus() == rsWillRecord))
    25132517            {
    2514                 if (pginfo->GetRecordingStatus() == rsWillRecord)
    2515                     VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("    Slave %1 will "
    2516                             "be in use in %2 minutes").arg(enc->GetHostName())
    2517                             .arg(secsleft / 60));
    2518                 else
    2519                     VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("    Slave %1 is "
    2520                             "in use currently recording '%1'")
    2521                             .arg(enc->GetHostName()).arg(pginfo->GetTitle()));
    2522                 SlavesInUse << enc->GetHostName();
     2518                VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("    Slave %1 will "
     2519                        "be in use in %2 minutes").arg(enc->GetHostName())
     2520                        .arg(secsleft / 60));
     2521                slavesInUse << enc->GetHostName();
    25232522            }
    25242523        }
    25252524    }
    25262525
    2527     VERBOSE(VB_SCHEDULE+VB_EXTRA, "  Checking inuseprograms table:");
     2526    VERBOSE(VB_SCHEDULE+VB_EXTRA, "2  Checking inuseprograms table:");
    25282527    QDateTime oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60);
    25292528    MSqlQuery query(MSqlQuery::InitCon());
    25302529    query.prepare("SELECT DISTINCT hostname, recusage FROM inuseprograms "
    void Scheduler::PutInactiveSlavesToSleep(void) 
    25332532    if (query.exec())
    25342533    {
    25352534        while(query.next()) {
    2536             SlavesInUse << query.value(0).toString();
     2535            slavesInUse << query.value(0).toString();
    25372536            VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("    Slave %1 is marked as "
    25382537                    "in use by a %2")
    25392538                    .arg(query.value(0).toString())
    void Scheduler::PutInactiveSlavesToSleep(void) 
    25412540        }
    25422541    }
    25432542
    2544     VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("  Shutting down slaves which will "
    2545             "be inactive for the next %1 minutes and can be put to sleep.")
    2546             .arg(sleepThreshold / 60));
     2543    QStringList slavesThatCanWake;
    25472544
    25482545    enciter = m_tvList->begin();
    25492546    for (; enciter != m_tvList->end(); ++enciter)
    25502547    {
    25512548        enc = *enciter;
     2549        QString slaveHost = enc->GetHostName();
    25522550
    25532551        if ((!enc->IsLocal()) &&
    25542552            (enc->IsAwake()) &&
    2555             (!SlavesInUse.contains(enc->GetHostName())) &&
    2556             (!enc->IsFallingAsleep()))
     2553            (!slavesInUse.contains(slaveHost)) &&
     2554            (!enc->IsFallingAsleep()) &&
     2555            (enc->GetSleepStatusTime().secsTo(curtime) > 300) &&
     2556            (!Scheduler::CheckDailyWakeUpPeriodSlave(slaveHost)))
    25572557        {
    25582558            QString sleepCommand = gCoreContext->GetSettingOnHost("SleepCommand",
    2559                 enc->GetHostName());
     2559                slaveHost);
    25602560            QString wakeUpCommand = gCoreContext->GetSettingOnHost("WakeUpCommand",
    2561                 enc->GetHostName());
     2561                slaveHost);
    25622562
    2563             if (!sleepCommand.isEmpty() && !wakeUpCommand.isEmpty())
     2563            if (!sleepCommand.isEmpty() && !wakeUpCommand.isEmpty() &&
     2564               (!slavesThatCanWake.contains(slaveHost)))
    25642565            {
    2565                 QString thisHost = enc->GetHostName();
     2566                slavesThatCanWake << slaveHost;
    25662567
    2567                 VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("    Commanding %1 to "
    2568                         "go to sleep.").arg(thisHost));
     2568                VERBOSE(VB_SCHEDULE+VB_EXTRA, QString("    Asking %1 to "
     2569                        "go to sleep.").arg(slaveHost));
    25692570
    2570                 if (enc->GoToSleep())
     2571                int goToSleep = enc->GoToSleep();
     2572                if (goToSleep == 1)
    25712573                {
    25722574                    QMap<int, EncoderLink *>::Iterator slviter =
    25732575                        m_tvList->begin();
    25742576                    for (; slviter != m_tvList->end(); ++slviter)
    25752577                    {
    25762578                        EncoderLink *slv = *slviter;
    2577                         if (slv->GetHostName() == thisHost)
     2579                        if (slv->GetHostName() == slaveHost)
    25782580                        {
    25792581                            VERBOSE(VB_SCHEDULE+VB_EXTRA,
    25802582                                    QString("    Marking card %1 on slave %2 "
    void Scheduler::PutInactiveSlavesToSleep(void) 
    25852587                        }
    25862588                    }
    25872589                }
    2588                 else
     2590                else if (goToSleep == -1)
    25892591                {
    25902592                    VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Unable to "
    25912593                            "shutdown %1 slave backend, setting sleep "
    2592                             "status to undefined.").arg(thisHost));
     2594                            "status to undefined.").arg(slaveHost));
    25932595                    QMap<int, EncoderLink *>::Iterator slviter =
    25942596                        m_tvList->begin();
    25952597                    for (; slviter != m_tvList->end(); ++slviter)
    25962598                    {
    25972599                        EncoderLink *slv = *slviter;
    2598                         if (slv->GetHostName() == thisHost)
     2600                        if (slv->GetHostName() == slaveHost)
    25992601                            slv->SetSleepStatus(sStatus_Undefined);
    26002602                    }
    26012603                }
    bool Scheduler::WakeUpSlave(QString slaveHostname, bool setWakingStatus) 
    26422644        enc->SetLastWakeTime(curtime);
    26432645    }
    26442646
     2647    VERBOSE(VB_SCHEDULE, QString("Trying to Wake Up %1.").arg(slaveHostname));
     2648
    26452649    if (!IsMACAddress(wakeUpCommand))
    26462650    {
     2651        wakeUpCommand = wakeUpCommand.replace(QRegExp("%SLAVE%"), QString("%1")
     2652                .arg(slaveHostname));
    26472653        VERBOSE(VB_SCHEDULE, QString("Executing '%1' to wake up slave.")
    26482654                .arg(wakeUpCommand));
    26492655        myth_system(wakeUpCommand);
    bool Scheduler::WakeUpSlave(QString slaveHostname, bool setWakingStatus) 
    26542660    return true;
    26552661}
    26562662
    2657 void Scheduler::WakeUpSlaves(void)
     2663bool Scheduler::WakeUpSlaves(bool forceWakeAll)
    26582664{
    2659     QStringList SlavesThatCanWake;
     2665    VERBOSE(VB_SCHEDULE, "Scheduler, Checking for slaves that can be wake up");
     2666    QStringList slavesThatCanWake;
    26602667    QString thisSlave;
     2668    bool slaveWaken = false;
    26612669    QMap<int, EncoderLink *>::Iterator enciter = m_tvList->begin();
    26622670    for (; enciter != m_tvList->end(); ++enciter)
    26632671    {
    26642672        EncoderLink *enc = *enciter;
    26652673
    2666         if (enc->IsLocal())
     2674        if ((!forceWakeAll && !enc->CanSleep()) || enc->IsAwake() || enc->IsLocal() || enc->IsWaking())
    26672675            continue;
    26682676
    26692677        thisSlave = enc->GetHostName();
    26702678
    26712679        if ((!gCoreContext->GetSettingOnHost("WakeUpCommand", thisSlave)
    26722680                .isEmpty()) &&
    2673             (!SlavesThatCanWake.contains(thisSlave)))
    2674             SlavesThatCanWake << thisSlave;
     2681            (!slavesThatCanWake.contains(thisSlave)))
     2682        {
     2683            slavesThatCanWake << thisSlave;
     2684
     2685            if (forceWakeAll || (!forceWakeAll && Scheduler::CheckDailyWakeUpPeriodSlaveAndEncoderStatus(thisSlave, enc)))
     2686            {
     2687                VERBOSE(VB_SCHEDULE,
     2688                    QString("Scheduler, Sending wakeup command to slave: %1")
     2689                    .arg(thisSlave));
     2690                WakeUpSlave(thisSlave);
     2691                slaveWaken = true;
     2692            }
     2693        }
    26752694    }
     2695    return slaveWaken;
     2696}
     2697
     2698QDateTime Scheduler::getDailyWakeupTime(QString sPeriod, QString slaveHostname)
     2699{
     2700    QString sTime = gCoreContext->GetSettingOnHost(sPeriod, slaveHostname, "00:00");
     2701    QTime tTime = QTime::fromString(sTime, "hh:mm");
     2702    QDateTime dtDateTime = QDateTime(QDate::currentDate(), tTime);
     2703
     2704    return dtDateTime;
     2705}
    26762706
    2677     int slave = 0;
    2678     for (; slave < SlavesThatCanWake.count(); slave++)
     2707bool Scheduler::CheckDailyWakeUpPeriodSlaveAndEncoderStatus(QString slaveHostname, EncoderLink *enc)
     2708{
     2709    QDateTime dtCurrent = QDateTime::currentDateTime();
     2710    if (Scheduler::CheckDailyWakeUpPeriodSlave(slaveHostname))
    26792711    {
    2680         thisSlave = SlavesThatCanWake[slave];
    2681         VERBOSE(VB_SCHEDULE,
    2682                 QString("Scheduler, Sending wakeup command to slave: %1")
    2683                         .arg(thisSlave));
    2684         WakeUpSlave(thisSlave, false);
     2712            if (enc->IsAsleep() && !enc->IsWaking())
     2713            {
     2714                VERBOSE(VB_SCHEDULE, QString("DailyWakupPeriod starts for "
     2715                            "slave backend %1, waking it up").arg(slaveHostname));
     2716                return true;
     2717            }
     2718            else if ((enc->IsWaking()) && (enc->GetSleepStatusTime()
     2719                        .secsTo(dtCurrent) < 370) &&
     2720                    (enc->GetLastWakeTime().secsTo(dtCurrent) > 60))
     2721            {
     2722                VERBOSE(VB_SCHEDULE, QString("DailyWakupPeriod already "
     2723                            "started for slave backend %1 but not yet "
     2724                            "available, trying to wake it up again.")
     2725                        .arg(slaveHostname));
     2726                return true;
     2727            }
    26852728    }
     2729    return false;
    26862730}
    26872731
     2732bool Scheduler::CheckDailyWakeUpPeriodSlave(QString slaveHostname)
     2733{
     2734    QDateTime dtPeriod1Start = getDailyWakeupTime("DailyWakeupStartPeriod1", slaveHostname);
     2735    QDateTime dtPeriod1End = getDailyWakeupTime("DailyWakeupEndPeriod1", slaveHostname);
     2736    QDateTime dtPeriod2Start = getDailyWakeupTime("DailyWakeupStartPeriod2", slaveHostname);
     2737    QDateTime dtPeriod2End = getDailyWakeupTime("DailyWakeupEndPeriod2", slaveHostname);
     2738    QDateTime dtCurrent = QDateTime::currentDateTime();
     2739
     2740    bool inPeriod = false;
     2741 
     2742    // taken from mythshutdown
     2743    // Check for time periods that cross midnight
     2744    if (dtPeriod1End < dtPeriod1Start)
     2745    {
     2746        if (dtCurrent > dtPeriod1End)
     2747            dtPeriod1End = dtPeriod1End.addDays(1);
     2748        else
     2749            dtPeriod1Start = dtPeriod1Start.addDays(-1);
     2750    }
     2751 
     2752    if (dtPeriod2End < dtPeriod2Start)
     2753    {
     2754        if (dtCurrent > dtPeriod2End)
     2755            dtPeriod2End = dtPeriod2End.addDays(1);
     2756        else
     2757            dtPeriod2Start = dtPeriod2Start.addDays(-1);
     2758    }
     2759 
     2760    // Check for one of the daily wakeup periods
     2761    if (dtPeriod1Start != dtPeriod1End)
     2762    {
     2763        if (dtCurrent >= dtPeriod1Start && dtCurrent <= dtPeriod1End)
     2764        {
     2765            VERBOSE(VB_SCHEDULE+VB_EXTRA, "In a daily wakeup period (1).");
     2766            inPeriod = true;
     2767        }
     2768    }
     2769 
     2770    if (dtPeriod2Start != dtPeriod2End)
     2771    {
     2772        if (dtCurrent >= dtPeriod2Start && dtCurrent <= dtPeriod2End)
     2773        {
     2774            VERBOSE(VB_SCHEDULE+VB_EXTRA, "In a daily wakeup period (2).");
     2775            inPeriod = true;
     2776        }
     2777    }
     2778 
     2779    return inPeriod;
     2780}
     2781
    26882782void *Scheduler::SchedulerThread(void *param)
    26892783{
    26902784    // Lower scheduling priority, to avoid problems with recordings.
  • mythtv/programs/mythbackend/scheduler.h

    diff --git a/mythtv/programs/mythbackend/scheduler.h b/mythtv/programs/mythbackend/scheduler.h
    index b7f7d05..4c1bf0d 100644
    a b class Scheduler : public QObject 
    8282
    8383    RecStatusType GetRecStatus(const ProgramInfo &pginfo);
    8484
     85    static bool CheckShutdownServer(int prerollseconds, QDateTime &idleSince,
     86                             bool &blockShutdown);
    8587    int GetError(void) const { return error; }
    8688
    8789  protected:
    class Scheduler : public QObject 
    131133    bool ChangeRecordingEnd(RecordingInfo *oldp, RecordingInfo *newp);
    132134
    133135    void findAllScheduledPrograms(RecList &proglist);
    134     bool CheckShutdownServer(int prerollseconds, QDateTime &idleSince,
    135                              bool &blockShutdown);
    136136    void ShutdownServer(int prerollseconds, QDateTime &idleSince);
    137137    void PutInactiveSlavesToSleep(void);
    138138    bool WakeUpSlave(QString slaveHostname, bool setWakingStatus = true);
    139     void WakeUpSlaves(void);
     139    bool WakeUpSlaves(bool forceWakeAll = true);
     140    bool CheckDailyWakeUpPeriodSlave(QString slaveHostname);
     141    bool CheckDailyWakeUpPeriodSlaveAndEncoderStatus(QString slaveHostname, EncoderLink *enc);
     142    QDateTime getDailyWakeupTime(QString sPeriod, QString slaveHostname);
    140143
    141144    int FillRecordingDir(const QString &title,
    142145                         const QString &hostname,