LexikCronFileGeneratorBundle icon indicating copy to clipboard operation
LexikCronFileGeneratorBundle copied to clipboard

Feature suggestion - equivalent to "mailto" option : "log_path"

Open raneomik opened this issue 1 year ago • 0 comments

Hello,

The "mailto" option is very usefull to know the cron status, but there is also the "redirect command output to file" method. I firstly thought this could be achieved using the cron command config, for example this way :

...
   -    
        name: 'Command'
        command: 'app:command >> cron-`date +%%Y%%m%%d`.log'
        env:
            staging: '0 5 * * *'

but it currently generates this crontab :

0 5 * * *  php8.2 path/to/staging app:command >> cron-`date +%Y%m%d`.log --env=staging

where the --env=staging at the end seems wrong.

Suggestion : new optional "log_file" or "log_path" (for example) config entry, global and cron level, and it could be used in the template.twig after --env={{ env }}

for example:

...
        log_file:  '/path/to/cron-`date +%%Y%%m%%d`.log'
...
   -    
        name: 'Command'
        command: 'app:command'
        log_file:  '/path/to/app-`date +%%Y%%m%%d`.log'   # overrides the global config
        env:
            staging: '0 5 * * *'

raneomik avatar Sep 26 '23 17:09 raneomik