From: Amos Jeffries Date: Fri, 13 Aug 2010 11:54:31 +0000 (+1200) Subject: Permit rotate logs from cachemgr X-Git-Tag: take1~390 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0383747d92754ae56b7fcf091950b4db518a3d1c;p=thirdparty%2Fsquid.git Permit rotate logs from cachemgr Given that reconfigure, shutdown and offline already have password-protected remote actions available it makes sense to permit the less critical rotate as well. --- diff --git a/src/CacheManager.h b/src/CacheManager.h index 975c96617b..e365132581 100644 --- a/src/CacheManager.h +++ b/src/CacheManager.h @@ -125,6 +125,12 @@ protected: virtual void run (StoreEntry *sentry); ReconfigureAction(); }; + class RotateAction : public CacheManagerAction + { + public: + virtual void run (StoreEntry *sentry); + RotateAction(); + }; class OfflineToggleAction : public CacheManagerAction { public: diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 23ae897b8b..807ff10da3 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -56,6 +56,7 @@ CacheManager::CacheManager() registerAction(new OfflineToggleAction); registerAction(new ShutdownAction); registerAction(new ReconfigureAction); + registerAction(new RotateAction); registerAction(new MenuAction(this)); } @@ -372,6 +373,21 @@ CacheManager::ReconfigureAction::run(StoreEntry * sentry) /// \ingroup CacheManagerInternal CacheManager::ReconfigureAction::ReconfigureAction() : CacheManagerAction("reconfigure","Reconfigure Squid", 1, 1) { } +/// \ingroup CacheManagerInternal +void +CacheManager::RotateAction::run(StoreEntry * sentry) +{ + debugs(16, DBG_IMPORTANT, "Rotate Logs by Cache Manager command."); + storeAppendPrintf(sentry, "Rotating Squid Process Logs ...."); +#ifdef _SQUID_LINUX_THREADS_ + rotate_logs(SIGQUIT); +#else + rotate_logs(SIGUSR1); +#endif +} +/// \ingroup CacheManagerInternal +CacheManager::RotateAction::RotateAction() : CacheManagerAction("rotate","Rotate Squid Logs", 1, 1) { } + /// \ingroup CacheManagerInternal void CacheManager::OfflineToggleAction::run(StoreEntry * sentry)