diff options
Diffstat (limited to 'Assistant.hs')
-rw-r--r-- | Assistant.hs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Assistant.hs b/Assistant.hs index c14f1e0df..3f4c4fabd 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -22,6 +22,8 @@ import Assistant.Threads.Merger import Assistant.Threads.TransferWatcher import Assistant.Threads.Transferrer import Assistant.Threads.SanityChecker +import Assistant.Threads.Cronner +import Assistant.Threads.ProblemFixer #ifdef WITH_CLIBS import Assistant.Threads.MountWatcher #endif @@ -47,6 +49,8 @@ import Assistant.Types.UrlRenderer import qualified Utility.Daemon import Utility.LogFile import Utility.ThreadScheduler +import Utility.HumanTime +import Annex.Perms import qualified Build.SysConfig as SysConfig import System.Log.Logger @@ -60,11 +64,13 @@ stopDaemon = liftIO . Utility.Daemon.stopDaemon =<< fromRepo gitAnnexPidFile - - startbrowser is passed the url and html shim file, as well as the original - stdout and stderr descriptors. -} -startDaemon :: Bool -> Bool -> Maybe HostName -> Maybe (Maybe Handle -> Maybe Handle -> String -> FilePath -> IO ()) -> Annex () -startDaemon assistant foreground listenhost startbrowser = do +startDaemon :: Bool -> Bool -> Maybe Duration -> Maybe HostName -> Maybe (Maybe Handle -> Maybe Handle -> String -> FilePath -> IO ()) -> Annex () +startDaemon assistant foreground startdelay listenhost startbrowser = do Annex.changeState $ \s -> s { Annex.daemon = True } pidfile <- fromRepo gitAnnexPidFile logfile <- fromRepo gitAnnexLogFile +#ifndef mingw32_HOST_OS + createAnnexDirectory (parentDir logfile) logfd <- liftIO $ openLog logfile if foreground then do @@ -83,6 +89,13 @@ startDaemon assistant foreground listenhost startbrowser = do Just a -> Just $ a origout origerr else start (Utility.Daemon.daemonize logfd (Just pidfile) False) Nothing +#else + -- Windows is always foreground, and has no log file. + start id $ + case startbrowser of + Nothing -> Nothing + Just a -> Just $ a Nothing Nothing +#endif where desc | assistant = "assistant" @@ -96,7 +109,6 @@ startDaemon assistant foreground listenhost startbrowser = do flip runAssistant (go webappwaiter) =<< newAssistantData st dstatus - #ifdef WITH_WEBAPP go webappwaiter = do d <- getAssistant id @@ -127,15 +139,20 @@ startDaemon assistant foreground listenhost startbrowser = do , assist $ daemonStatusThread , assist $ sanityCheckerDailyThread , assist $ sanityCheckerHourlyThread + , assist $ problemFixerThread urlrenderer #ifdef WITH_CLIBS - , assist $ mountWatcherThread + , assist $ mountWatcherThread urlrenderer #endif , assist $ netWatcherThread , assist $ netWatcherFallbackThread , assist $ transferScannerThread urlrenderer + , assist $ cronnerThread urlrenderer , assist $ configMonitorThread , assist $ glacierThread , watch $ watchThread + -- must come last so that all threads that wait + -- on it have already started waiting + , watch $ sanityCheckerStartupThread startdelay ] liftIO waitForTermination |