Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved How to add cronjob to running cloudron app?

    Support
    cron
    5
    5
    867
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M-arcus
      M-arcus last edited by girish

      See title

      Putting it in repairmode and trying to add it to the crontab doesn't work.

      1 Reply Last reply Reply Quote 1
      • M
        msbt App Dev last edited by

        If it's a LAMP, this will do it:
        https://cloudron.io/documentation/apps/lamp/#cron-support

        If it's a custom one:
        https://cloudron.io/developer/addons/#scheduler

        S 1 Reply Last reply Reply Quote 2
        • S
          simon @msbt last edited by

          @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?

          1 Reply Last reply Reply Quote 0
          • nebulon
            nebulon Staff last edited by

            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.

            1 Reply Last reply Reply Quote 1
            • girish
              girish Staff last edited by

              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
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB