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 Support at command in LAMP app

    LAMP
    lamp cron
    2
    5
    170
    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.
    • alex-adestech
      alex-adestech last edited by girish

      Is it possible to enable the at command using a LAMP app?

      I installed it using apt-get in a custom LAMP app, but I cannot enable it or use it. My goal is to schedule a task (run a script) at the indicated time (timestamps are downloaded from a server and may vary from day to day).

      Screen Shot 2020-08-13 at 19.39.47.png

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

        @alex-adestech Looks like the at command will require a daemon atd to run. Would it be possible to workaround using cron instead? The lamp app has built-in cron support using which you can schedule at any specific time - https://cloudron.io/documentation/apps/lamp/#cron-support

        1 Reply Last reply Reply Quote 0
        • alex-adestech
          alex-adestech last edited by

          @girish Well, the thing is that I download a JSON Object with some timestamps indicating the next time the server needs to run a specific script. These timestamps are different each day.

          For example, Monday the 1st should run at 3pm and 5 pm, but next Monday should run at 1pm and 9 pm.

          Could it be possible to edit the crontab file using a script?
          The lamp app needs to restart after cron has changed right?

          Maybe that could be a workaround.

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

            @alex-adestech Ah, I see. The usual workaround for this is to put a command in crontab like so:

            0 * * * * php /app/data/periodic.php
            

            The above runs every hour. Then in periodic.php, you can check the current time or some file to see what tasks you want to run etc.

            Would that work?

            1 Reply Last reply Reply Quote 1
            • alex-adestech
              alex-adestech last edited by

              @girish you're a genius man! I think it should work, I'll try it and come back. Thanks!!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB