flask-crontab
flask-crontab copied to clipboard
Allow additional configurations to manually extend the crontab execution command
Right now, the configuration only allows to adjust the following two parameters:
| Config item | Description | Default value |
|---|---|---|
| CRONTAB_EXECUTABLE | The absolute path of crontab |
/usr/bin/crontab |
| CRONTAB_LOCK_JOBS | Whether lock jobs when running | False |
However, it would be great if there are two additional configuration variables that allow to add a prefix and a suffix to the command. For example, this could look like the following (taken from the django-crontab project):
CRONTAB_COMMAND_PREFIX
- something you want to do or declare, before each job gets executed. A good place for environment variables.
- default: '' (empty string)
- example: 'STAGE=production'
CRONTAB_COMMAND_SUFFIX
- something you want to do after each job was executed.
- default: '' (empty string)
- example: '2>&1'
That would allow me to redirect the output stream with the suffix and set important environment variables with the prefix configuration.
Unlike django-crontab, we don't have to rely on the config, we can also specify that per task.
Thanks for the quick reply! Unfortunately, I don't completely understand that. Could you maybe provide an example how I could possibly add a prefix to my function?
I mean it is not supported, but we may have more options on how to do it.
I mean it is not supported, but we may have more options on how to do it.
Alright, gotcha! Thanks for the clarification. I might provide a PR for the feature in case I find the time for it.