Monitor Symfony Console Commands
A Symfony console command invoked on a schedule — via system cron or the Scheduler component — is monitored the same simple way as any other framework command: a ping at the end, after the real work succeeds.
Setup
Create an incoming monitor
Add a heartbeat monitor in Pingtastic with a grace period past the command's schedule interval.
Ping at the end of the command's execute() method
Add the ping call after the real work succeeds, before returning Command::SUCCESS.
protected function execute(InputInterface $input, OutputInterface $output): int
{
// ...existing command logic...
$this->httpClient->request('GET', 'https://ping.pingtastic.net/ping/nightly-sync');
return Command::SUCCESS;
}Schedule it
With system cron, or Symfony's Scheduler component if you're using it for in-process recurring messages.
0 4 * * * /usr/bin/php /var/www/app/bin/console app:nightly-sync --env=prodGotchas
- ⚠Returning anything other than Command::SUCCESS (including an uncaught exception) should happen before the ping line — double-check the ping is placed after all possible early-return failure paths, not just at the top of execute().
- ⚠Cron-invoked commands don't get your shell's environment — pass --env=prod explicitly and make sure your production env file is in place, since a command that silently falls back to the dev environment can behave very differently.
Questions
Does this work with the Symfony Scheduler component instead of system cron?
Yes — the Scheduler component ultimately still calls into your handler code, so a ping at the end of that handler works the same way regardless of what triggers it.
Should I ping from a listener instead of inside each command?
You can centralize it with a console command listener on ConsoleEvents::TERMINATE if you have many commands to monitor, but pinging explicitly inside each command keeps each monitor's success condition explicit and easier to reason about.
Related guides
Start monitoring your Symfony console command
Set up your first monitor in under five minutes.
Get started — $5/month