File tree Expand file tree Collapse file tree 4 files changed +39
-20
lines changed
Expand file tree Collapse file tree 4 files changed +39
-20
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Console \Commands ;
4+
5+ use App \Console \LnmsCommand ;
6+ use Illuminate \Support \Facades \Cache ;
7+ use LibreNMS \Util \Notifications ;
8+
9+ class MaintenanceFetchRSS extends LnmsCommand
10+ {
11+ /**
12+ * The name of the console command.
13+ *
14+ * @var string
15+ */
16+ protected $ name = 'maintenance:fetch-rss ' ;
17+
18+ /**
19+ * Execute the console command.
20+ */
21+ public function handle (): int
22+ {
23+ $ lock = Cache::lock ('notifications ' , 86000 );
24+ if ($ lock ->get ()) {
25+ Notifications::post ();
26+ $ lock ->release ();
27+
28+ return 0 ;
29+ }
30+
31+ return 1 ;
32+ }
33+ }
Original file line number Diff line number Diff line change 188188 }
189189}
190190
191- if ($ options ['f ' ] === 'notifications ' ) {
192- $ lock = Cache::lock ('notifications ' , 86000 );
193- if ($ lock ->get ()) {
194- Notifications::post ();
195- $ lock ->release ();
196- }
197- }
198-
199191if ($ options ['f ' ] === 'bill_data ' ) {
200192 // Deletes data older than XX months before the start of the last complete billing period
201193 $ msg = "Deleting billing data more than %d month before the last completed billing cycle \n" ;
Original file line number Diff line number Diff line change @@ -369,9 +369,7 @@ main () {
369369
370370 # List all tasks to do after pull in the order of execution
371371 status_run ' Updating SQL-Schema' ' ./lnms migrate --force --no-interaction --isolated'
372- status_run ' Updating submodules' " $DAILY_SCRIPT submodules"
373372 status_run ' Cleaning up DB' " $DAILY_SCRIPT cleanup"
374- status_run ' Fetching notifications' " $DAILY_SCRIPT notifications"
375373 status_run ' Caching PeeringDB data' " $DAILY_SCRIPT peeringdb"
376374 ;;
377375 cleanup)
@@ -392,16 +390,6 @@ main () {
392390 " ports_purge" )
393391 call_daily_php " ${options[@]} "
394392 ;;
395- submodules)
396- # Init+Update our submodules
397- git submodule --quiet init
398- git submodule --quiet update
399- ;;
400- notifications)
401- # Get notifications
402- options=(" notifications" )
403- call_daily_php " ${options[@]} "
404- ;;
405393 peeringdb)
406394 options=(" peeringdb" )
407395 call_daily_php " ${options[@]} "
Original file line number Diff line number Diff line change 33use App \Console \Commands \MaintenanceCleanupNetworks ;
44use App \Console \Commands \MaintenanceCleanupSyslog ;
55use App \Console \Commands \MaintenanceFetchOuis ;
6+ use App \Console \Commands \MaintenanceFetchRSS ;
67use App \Jobs \PingCheck ;
78use Illuminate \Support \Facades \Artisan ;
89use Illuminate \Support \Facades \Cache ;
184185 ->onOneServer ()
185186 ->appendOutputTo ($ maintenance_log_file );
186187
188+ Schedule::command (MaintenanceFetchRSS::class)
189+ ->dailyAt (Time::pseudoRandomBetween ('03:00 ' , '03:59 ' ))
190+ ->onOneServer ()
191+ ->appendOutputTo ($ maintenance_log_file );
192+
187193Schedule::command (MaintenanceCleanupSyslog::class)
188194 ->dailyAt ('03:30 ' )
189195 ->onOneServer ()
You can’t perform that action at this time.
0 commit comments