I Need To Know How To Run CronJobs

I have Elgg version v3.3.8  and I have PHP 7.4 in my website.

I would like you to tell me how to run Cron Jobs. What is the real command to type on the server and start the site with that Elgg version v3.3.8 running Crons.

I want to upload videos to the iZAP Videos with the command  " /usr/bin/ffmpeg -y -i [inputVideoPath] [outputVideoPath] "  (ffmpeg version 3.3.1)  and even when the php report said it great, it doesn't convert the videos. I also would like to make my website updates automatically, but the cron page on the site's administrator reports that never " Latest Cron Jobs  = Never".
How can I start the site running these crons? What is the address to type as command, so I can tell the server administrator to run those cronjobs for me. Can someone tell me? Please, I greatly appreciate your help and opinions..

  • The setting up of cronjobs depends on what administration tool(s) are used on your server to allow for configuration of services on your webspace. Do you have CPanel or some other such tool? Without knowing which tool is used it's impossible to give detailed info on how to set up cronjobs because how to do it is not connected with Elgg in the first. Only the exact command parameters of the specific cronjobs for Elgg are then connected with Elgg. For example in https://elgg.org/discussion/view/2990709/event-calendar-not-sending-reminders there's some more info on how the cronjobs would look like (while Elgg 3 would allow for the cronjobs getting configured using the elgg-cli script I personally prefer the old way already available on Elgg 2 with triggering the cronjobs using the wget command / alternatively the lwp-request command).

    You would have to ask the support of your webhoster how you can add cronjobs on your server. Maybe you already manage with the discussion I've linked above to add the cronjobs for Elgg. As I said, they are not to be added within your Elgg site (and are not directly connected with plugins you use but there are Elgg-wide jobs that just trigger functionality of the site as specific intervals like 1 minute, 1 hour, daily etc.).

    As a temporary solution (until you figure out how to set up the cronjobs on your server) you can try the Crontrigger plugin (https://elgg.org/plugins/2512029). It's not working as reliable as real cronjobs because it makes use of user activity to trigger the cron funtionality and with no user on your site at a time nothing is triggered.

  • I have Cpannel with Web SSH and capable to run Cronjobs.
     
    These is what the server says     " Here is an example of running shell command driven cron jobs and script execution cron jobs:
     
    0 * * * * rm -f * /home/www/my-best-domain.com/temp/
     
    This command will initiate the rm (remove/delete) utility for file/folder deletion and will forcibly delete all the files under /home/www/my-best-domain.com/temp/
     
    Let us say that you want to mail newsletters, site updates, etc. to your clients on a daily basis.
     
    Most script systems have already prebuilt scripts for this purpose and many more automated services.
     
    The cron job would look like this:
     
    0 0 0 0 * /usr/bin/php /home/www/my-best-domain.com/mailcron.php  "
     
    Fiel extentions allowed at this server are:
    These are PHP, Perl/CGI and bash scripts – with the corresponding extensions - *.php, *.pl and *.sh.
    ------------------------
     
    I have this Clipbucket site for videos at bookoflikes.com/video but i want these videos also at the main domain.
     
    maybe these settings at the Clipbucket site can help in some ways because they work good in the same server:
     
    FFMPEG Path  /usr/bin/ffmpeg
    MP4Box Path  /usr/bin/MP4Box
    Imagick Path /usr/bin/convert
    Max time wait after max processess  7200
     
    Video Codec libx264
    Audio Codec libfaac
    Video Rate 25
    Video Bitrate 512000
    Video Bitrate For Hd 500000
    Audio Rate 22050
    Audio Bitrate 128000
    -------------------------------
     
    What I have on the Elgg site is:
     
    Path for the PHP interpreter:
    /usr/bin/php
     
    Video converting command:
    /usr/bin/ffmpeg -y -i [inputVideoPath] [outputVideoPath]
    (Optimized command: /path/of/ffmpeg -y -i [inputVideoPath] -vcodec libx264 -preset medium -b:v 330k -s 480x360 -acodec aac -ar 22050 -ab 48k [outputVideoPath] )
     
    Video thumbnail command:
    /usr/bin/ffmpeg -y -i [inputVideoPath] -vframes 1 -ss 00:00:10 -an -vcodec png -f rawvideo -s 320x240
     
    Set cron interval to trigger queue:
    1 minute
     
    Regards.
  • On the second page of https://elgg.org/discussion/view/2990709/event-calendar-not-sending-reminders?offset=10 you could read an explanation of what the cronjobs would look like in text form. Please read.

    Here just one example for the one minute interval:

    * * * * * /usr/bin/wget --output-document=/dev/null https://bookoflikes.com/cron/minute/ >/dev/null 2>&1

    The stars at the beginning define the intervals (minute, hour etc.). Cpanel offers some typical intervals you can select without the need to know exactly what the parameters are about (for the other intervals please read the other discussion).

    The part after the stars:

    /usr/bin/wget --output-document=/dev/null https://bookoflikes.com/cron/minute/ >/dev/null 2>&1

    ist the actual command the is executed by the cron daemon. It uses the command wget (assuming it's at the path /usr/bin) to call the page https://bookoflikes.com/cron/minute/ of your site. A call to this site results in the Elgg engine to trigger the execution of the functions registered for the corresponding cron interval. The other parts of the command only tell the wget command to omit logging.

    So, start with creating 1 cronjob for the 1 minute intervall in CPanel with the command above. Then check on your site if the Latest Cron interval output changes from "Never" to the time of last execution.

    For the other intervals (see what are available at the other discusion) it works in the same way: you would add a new job for each interval. The commands are almost the same with only the last segment of the url being different corresponding to the interval. And for selecting the interval you should be able to choose from the available interval options for almost all intervals (I think only the 15 or 30 minute job are not offered by default but you can easily adapt the one missing once you see how the parameters for the other look like).

  • This is a share cloud server and it is not working, jet.  I appreciate your information big time. Thank You.

  • What's not working?

    Do you know if the wget command is available at /usr/bin/wget? If not, you need to modify the path according to the location of wget on your server (if in doubt, ask the support of your webhoster).

    Go to the "Configure" - "Security" section in the admin area of your site. There's the option "Protect /cron URLs". If this option is enabled, you need to add the security token to the cron URL in the command of the cronjob you add in CPanel. The token is site specific and also different for each cron interval. But you can copy+paste the URLS from there into the cron command easily.

    To test the cronjobs manually you can also enter the cron URLs manually in your browser (e.g. https://bookoflikes.com/cron/minute). Then you should see that the cronjobs of this interval should have run. And the video conversion should also get triggered.

Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.