How to increase cron interval in WP-unmanaged app?



  • Hi all,

    The standard cron interval in the (unmanaged)-Wordpress app is 5 minutes, I would like to increase this to 1 minute (I use the unmanaged WP app).

    How do I do that as it is not a config item in Cloudron?

    Kind regards,

    Marcel.



  • @imc67 The cron file might be in /app/data/crontab or similar name, can you see a file like that?



  • Hi @murgero, thanks for your quick response!

    In that folder there are only: credentials.txt php.ini /public 😞

    Kind regards,

    Marcel.



  • @imc67 You can make the file (assuming wp-unmanged is based on the LAMP app) called crontab and put what you need in there. Would be worth a test.



  • Currently there is no way to customize the cron schedule, it is fixed in the app package manifest to every 5 minutes. What is the use-case for making this more frequent? We can change this if there are good reasons.



  • @nebulon Hi Johannes, thanks for your response. In Wordpress itself there are 1 minute cron interval types and plugins are using it. Now some plugins give cron-errors like "there are 5 unfinished cron tasks, is there something wrong with your cron?".

    Kind regards,

    Marcel.



  • @imc67 We will push an update so that the cron interval is configurable.



  • @girish this would be awesome!!!



  • @girish Today there was an app update to 1.2.2 with description: Make cron granularity 1 second

    I was very curious what was changed and I discovered the cron interval is now every 2 minutes. In the app manifest (yes I've found that 😉 ) the cron is now:

    "schedule": "*/1 * * * *"

    This means every other minute (so every 120 seconds). Now I'm very curious what the update description means?

    With these 2 minutes I'm already happy, it would be a little bit better to have it every minute: "schedule": "* * * * *"

    Kind regards and keep up the good work! I'm already have some production sites in Cloudron and unmanagedWP-app and I'm very very happy with this great product!!

    Kind regards,

    Marcel



  • @imc67 The pattern means every minute. Why do you think it means every 2 minutes? https://cronexpressiondescriptor.azurewebsites.net/?expression=%2F1++++*&locale=en

    Also, for code changes, you can always track https://git.cloudron.io/cloudron/wordpress-unmanaged-app



  • @girish Hi, thanks for your response, the result of the "*/1 * * * *" is:

    [2019-05-31 09:10:31] - [Cron Request]- 120.29s after the previous one. | Cron called from 127.0.0.1 (?)
    [2019-05-31 09:08:31] - [Cron Request]- 119.87s after the previous one. | Cron called from 127.0.0.1 (?)
    [2019-05-31 09:06:31] - [Cron Request]- 120.13s after the previous one. | Cron called from 127.0.0.1 (?)
    [2019-05-31 09:04:31] - [Cron Request]- 119.92s after the previous one. | Cron called from 127.0.0.1 (?)
    [2019-05-31 09:02:31] - [Cron Request]- 119.97s after the previous one. | Cron called from 127.0.0.1 (?)
    

    So all almost exactly 120 seconds interval.

    As far as I know a 1 minute interval is "* * * * *" (https://crontab.guru/every-minute)

    So it would be really great if this could be implemented 🙂

    Kind regards,

    Marcel.



  • Apparently both patterns are equivalent, not sure why you see those exactly two minutes apart. I did a quick test locally with the same cron module and I get for both every minute. Will do a cloudron app test later.



  • I just tested the WordPress unmanaged app regarding the currently published cron pattern and I cannot reproduce the 2 minutes interval:

    10:44:09 - => Run cron job
    10:44:10 - Success: Executed a total of 0 cron events.
    10:45:09 - => Run cron job
    10:45:10 - Success: Executed a total of 0 cron events.
    10:46:09 - => Run cron job
    10:46:10 - Success: Executed a total of 0 cron events.
    

    Not sure what the difference between our two deployments are now.



  • @nebulon OMG I have to apologize!

    This log is from a plugin and that has an own 2 minute schedule 😞
    I checked the app log and there is indeed a 1 minute cron call.

    I'm deeply ashamed for this mistake, sorry!

    Kind regards,

    Marcel.



  • No worries, at least now we know what happened.


Log in to reply