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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. How to add cronjob to running cloudron app?

How to add cronjob to running cloudron app?

Scheduled Pinned Locked Moved Solved Support
cron
5 Posts 5 Posters 1.8k Views 5 Watching
  • 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-arcusM Offline
    M-arcusM Offline
    M-arcus
    wrote on last edited by girish
    #1

    See title

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

    1 Reply Last reply
    1
    • M Offline
      M Offline
      msbt
      App Dev
      wrote on last edited by
      #2

      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
      2
      • M msbt

        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 Offline
        S Offline
        simon
        wrote on last edited by
        #3

        @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
        0
        • nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #4

          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
          1
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #5

            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
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Bookmarks
            • Search