How to add cronjob to running cloudron app?
-
If it's a LAMP, this will do it:
https://cloudron.io/documentation/apps/lamp/#cron-supportIf it's a custom one:
https://cloudron.io/developer/addons/#scheduler -
@msbt I would also have to create a cron, but in the Redmine app (so Redmine can receive mails http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails).
If I understand that correctly, it is only possible via the scheduler addon. But can I still install this? -
Currently the redmine app package does not have the cron addon enabled and this cannot be done afterwards, without a new package version using it. I will check, if it is ok, that we publish a new one with cron enabled and a script hook to add the commands mentioned in the redmine forum link.
-
As others said, usually the cron job is part of the app itself. If for some reason you want to run some cron task outside the scope of the app, then you can use a script like below and put it in the crontab of your server.
#!/bin/bash # this is the app's domain name app="test.smartserver.space" # detect the container id of the app container_id=$(docker ps -q -f label=fqdn=$app -f label=isSubcontainer=false) echo "App container id is : $container_id" # we can now run arbitrary commands in the container. below we run a command as the www-data user. docker exec $container_id sudo -u www-data ls -l