-
Notifications
You must be signed in to change notification settings - Fork 92
Fix cron: add cron task only once and start cron service #92
Conversation
If you change DOLI_CRON_KEY or DOLI_CRON_USER, the cron task will not be updated. |
Yes, its true, we can update the cron task at each run if you prefer ? |
Currently, the cron file is already regenerated at each run. |
ok, I updated the |
# Remove old file | ||
if [[ -f ${DOLI_CRON_FILE} ]]; then | ||
rm -rf ${DOLI_CRON_FILE} | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary because the content will be overwritten by the first echo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's true! It was just to be clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to delete it only if it is there, you don't have to test, you can do rm -rf ${DOLI_CRON_FILE}
without the if.
echo "*/5 * * * * www-data /var/www/scripts/cron/cron_run_jobs.php ${DOLI_CRON_KEY} ${DOLI_CRON_USER} > /var/www/documents/cron_run_jobs.php.log 2>&1" >> /etc/cron.d/dolibarr | ||
cron -f | ||
exit 0 | ||
DOLI_CRON_FILE=/etc/cron.d/dolibarr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's really necessary to create a variable for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is to be cleaner !
@@ -198,7 +198,7 @@ function run() | |||
initDolibarr | |||
echo "Current Version is : ${DOLI_VERSION}" | |||
|
|||
if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ${DOLI_CRON} -ne 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then | |||
if [[ ${DOLI_INSTALL_AUTO} -eq 1 && ! -f /var/www/documents/install.lock && ${DOLI_DB_TYPE} != "pgsql" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database update should be done only from the main container.
Please open another PR if needed. |
Fix: