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. App Packaging & Development
  3. Crontab not running in custom LAMP

Crontab not running in custom LAMP

Scheduled Pinned Locked Moved App Packaging & Development
13 Posts 3 Posters 1.5k Views 3 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.
  • A Offline
    A Offline
    alex-uxlabsmx
    wrote on last edited by alex-uxlabsmx
    #3

    I want to let the user configure custom cron jobs. What's the best approach to run crond in the container automatically?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      joseph
      Staff
      wrote on last edited by
      #4

      You can check the mautic package (https://git.cloudron.io/cloudron/mautic-app) how to run crond via supervisor. But any reason not to use https://docs.cloudron.io/apps/#cron ?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alex-uxlabsmx
        wrote on last edited by
        #5

        Well, I understand that cron is already configured from what I see in the docs:

        Cron jobs required for the app to function are already integrated into the app package and no further configuration is required. If you want to run additional custom cron commands, you can add them in the Cron section.

        The thing is that jobs are not running. I'm not sure if I deleted something important from the Dockerfile or if I need anything else to make cron work. This is how I added a job:
        Screenshot 2024-07-25 at 10.19.56 a.m..png

        J 1 Reply Last reply
        0
        • A alex-uxlabsmx

          Well, I understand that cron is already configured from what I see in the docs:

          Cron jobs required for the app to function are already integrated into the app package and no further configuration is required. If you want to run additional custom cron commands, you can add them in the Cron section.

          The thing is that jobs are not running. I'm not sure if I deleted something important from the Dockerfile or if I need anything else to make cron work. This is how I added a job:
          Screenshot 2024-07-25 at 10.19.56 a.m..png

          J Offline
          J Offline
          joseph
          Staff
          wrote on last edited by
          #6

          @alex-uxlabsmx cron support comes from the platform code and should not be related to the packaging. Can you try the cron job in some other app ? (just the echo, remove the python stuff) . That way, we can figure if this is an app level issue or platform level.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alex-uxlabsmx
            wrote on last edited by
            #7

            We have several Apps running cron jobs without any problem. It must be an app level issue. The following screenshots are from another App running a cron job:

            Screenshot 2024-07-25 at 2.15.58 p.m..png

            Screenshot 2024-07-25 at 2.13.43 p.m..png

            1 Reply Last reply
            0
            • J Offline
              J Offline
              joseph
              Staff
              wrote on last edited by
              #8

              Only the cron job of running and healthy apps are run i.e it responds to health checks and this will result in dashboard saying 'Running'. Is that the case with the app? If so, I can't quite make out. Do you have a test repo for us where we can build it ourself?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alex-uxlabsmx
                wrote on last edited by
                #9

                Sorry I forgot about this. I haven't solved this issue yet. Yes, the case you mention is correct; health checks are okay and it says Running. Crons are just not working at all. This is the repo https://github.com/alex-uxlabs/demo-lamp

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  joseph
                  Staff
                  wrote on last edited by
                  #10

                  @alex-uxlabsmx as a final test, I would also do systemctl restart box and check if that helps . I can give your repo a try if that doesn't work either.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    alex-uxlabsmx
                    wrote on last edited by
                    #11

                    I ran this command but it's still is not working. I tried running the commands in my cron manually and they're working fine. The only problem is that Cron is not executing anything. I'm not sure if a specific version of PHP is needed since I removed all except 8.1

                    girishG 1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      joseph
                      Staff
                      wrote on last edited by
                      #12

                      @alex-uxlabsmx I am afraid you have to contact support@cloudron.io at this point, out of ideas 😞 Have to debug the server.

                      1 Reply Last reply
                      1
                      • A alex-uxlabsmx

                        I ran this command but it's still is not working. I tried running the commands in my cron manually and they're working fine. The only problem is that Cron is not executing anything. I'm not sure if a specific version of PHP is needed since I removed all except 8.1

                        girishG Do not disturb
                        girishG Do not disturb
                        girish
                        Staff
                        wrote on last edited by
                        #13

                        @alex-uxlabsmx should work now. there were a couple of issues in the crontab:

                        • '&' in the end of the cron line. this puts the command in the background. cronjobs are not run in background and instead run on a schedule. so, the '&' should be removed.
                        • 'source' command is a bash primitive. you have to wrap it in bash -c "source ... && anothercommand", for example

                        seems to work after that.

                        1 Reply Last reply
                        1
                        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