Skip to content

Fix Schedules not running via "Run Now" if schedule is marked "Only when server is online" - #5689

Open
Sanic5238 wants to merge 3 commits into
pterodactyl:1.0-developfrom
Sanic5238:fix/force-manual-schedule-run
Open

Fix Schedules not running via "Run Now" if schedule is marked "Only when server is online"#5689
Sanic5238 wants to merge 3 commits into
pterodactyl:1.0-developfrom
Sanic5238:fix/force-manual-schedule-run

Conversation

@Sanic5238

@Sanic5238 Sanic5238 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Small fix that fixes an issue where using the [Run Now] function within a schedule it will silently fail and refuse to run if the schedule tasks are set to run only when server is online.

If the user would like to force run a schedule via the button, the expectation would be for the schedule to run even with these settings.

This issue was originally caused by $now not getting checked as part of https://github.com/pterodactyl/panel/blob/1.0-develop/app/Services/Schedules/ProcessScheduleService.php#L45 meaning it would the resulting task would get thrown away before it could be handled. This has been fixed via adding it to the if statement

After implementing an issue was found in testing where schedules that included console command runs would cause an error message to appear, due to the console being unreachable, in technicality telling the schedules to continue on failure would fix this, but users shouldn't be expected to turn this on and since the error had no information this would of caused undue stress on the discord lol. This has been fixed as per the below

Added a helper script within the RunTaskJob.php to allow skipping of a schedule task but to continue the rest of the schedule to ensure tasks are marked off the daemon to ensure schedules don't get stuck processing.

also added use Pterodactyl\Models\Task to ProcessScheduleService as it was needed for the check.

otherwise also added an if statement to check if this condition is met [Server is offline/stopping and task is to send a command] and if so to skip the task and move to the next.

Testing for this fix involved and results

  • Set Schedule to run command actions while server Online > As Expected [Ran]
  • Forced Schedule to run command actions while server Online > As Expected [Ran]
  • Allowed Schedule to run command actions while server Online > As Expected [Ran]
  • Set Schedule to run command actions while server Offline > As Expected [Did not run]
  • Forced Schedule to run command actions while server Offline > As Expected [Did not run/Skipped Task]
  • Allowed Schedule to run command actions while server Offline > As Expected [Did not run]

Below tests were added after failures caused in first commit of schedules not running after the action command due to failure as console was offline.

  • Set Schedule with multiple actions in the order of [ACTION_COMMAND > ACTION_POWER] to run while Server Online > As Expected [Ran]
  • Set Schedule with multiple actions in the order of [ACTION_COMMAND > ACTION_POWER] to run while server Offline > As Expected [Did not run]
  • Forced Schedule with multiple actions in the order of [ACTION_COMMAND > ACTION_POWER] to run while server online > As Expected [Ran Successfully]
  • Forced Schedule with multiple actions in the order of [ACTION_COMMAND > ACTION_POWER] to run while server Offline > As Expected [Ran Successfully]

Currently there's no notification sent that a task was skipped as part of this condition, please let me know if you'd like some sort of notification for the user during this edge case.

Fixes: #5258

@Sanic5238 Sanic5238 changed the title Fix/force manual schedule run Fix Schedules not running via "Run Now" if schedule is marked "Only when server is online" Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schedule "Run Now" doesn't run if "Only When Server Is Online" is enabled

1 participant