SUGGESTION: Custom commands on server restart

Magento (and of course other platforms) have cron jobs and restarting the server when these jobs are running can cause errors that might need to manually resolve.

If Magento is set to maintenance mode before performing a restart, the next cron job will not run because of this flag. Can this command automatically run before restarting a server and disable maintenance right after it reboots?

Commands for this would be:

bin/magento maintenance:enable

  • Wait for a while if possible, normal delay or one that can be set (up to a minute I’m guessing)

Restart without worrying about cron jobs accidental run

After server up and running, run this command

bin/magento maintenance:disable

This should not apply to plain shutdowns as these might be archived or something so probably not but and option to enable/disable this would be great.