Course copying in progress - STUCK

Re: Course copying in progress - STUCK

by Mike North -
Number of replies: 2
The following worked for me, hopefully it will help others, specifically those who use Siteground (which no longer uses cPanel).

I didn't enable asynchronous backup (not sure if I need to or not, but my courses finished copying once I did the below so for the time being I haven't enabled this option).

This is the command that I used:

/usr/bin/php /home/a111-okjulkji65rr/www/mywebsite.com/public_html/moodlesite/admin/cli/cron.php >/dev/null


Don't copy and paste the above command! Instead create a new one and fill it with information specific to your website.

How to create your own command and each portion of the above code is explained below:

1.   /usr/bin/php

This is the location of where php can be found on Siteground. For siteground you do not need to put the specific php version, unless you have installed multiple versions and want to point to a specific version. If you're not sure where your webhost keeps the latest php version then contact them to find out, otherwise try the above.

There is a space between this and the next portion, that's not a mistake.


2.   /home/a111-okjulkji65rr/www/iloveapples.com/public_html/moodlesite/admin/cli/cron.php >/dev/null

This is the command that we want executed in the background on our website. It's basically saying "look in this location of my website, find the file named cron.php and execute it".

Now to explain each component within this string so you can create your own command.

2.1   /home
Leave this as it is, it just says to start looking in the home folder on your website.

2.2   /a111-okjulkji65rr
This is apparently my username on Siteground, although I'd never seen it before and is not the same as my login username.
(Please note the one shown above is not my real username, it is a fake one I'm using in this example for security reasons but looks similar to my real one and if you use Siteground then yours will look similar.).

To find your username either contact your website or if you use Siteground to host your website then go to:
Site Tools  >  Devs  >  SSH Keys Manager

Now maximise your browser so you can see a grey box halfway down the page on the right hand side titled SSH CREDENTIALS and it will show your username there. If you can't find it then contact your webhost (I couldn't see it at first as my browser screen was not maximised and Siteground completely removes this grey box unless the browser window is stretched wide.... thanks Siteground!).

2.3   /www/iloveapples.com

This is where you enter your website URL. (This is not my actual website, just using a fake one for this example.)
The forward slash after www is not a mistake (don't use a period . )

So if your website is:


then convert this to:

/www/artsandcraftsinmichigan.com

2.4 /public_html/moodlesite/admin

This is the specific folder where the file named cron.php can be found on my website, but it will be a bit different for you. The main difference will probably be what folder your moodle website is located in. Mine is located in a folder called "moodlesite" so find your folder name and use that instead, but the "public_html" and "admin" portion will most likely be the same as in the example above.

If you're not sure then search your website and look for the file named cron.php then type in the path where it can be found. Again, contact your webhost if you're not sure what to put here.

2.5   /cron.php

As mentioned above, this is the actual file that we want our website to execute in the background so no need to change this.

There is a space between this and the next portion, that's not a mistake.


3.   >/dev/null

You don't have to enter this, but it basically says "don't send me notification emails every time this command is executed". If you leave it out then you will receive a notification email every time the command is executed. 

I would recommend initially to not include this so you can see if the command is actually working or not, then once you can see it's working add it to your command. Others have mentioned you can see the status of your command within Moodle but I haven't figured out how to do that yet.


Ok so those are all the necessary components. Now using the info above create your own command. Maybe type it up in Microsoft Word / Notepad etc. so you can easily copy and paste it.

If using Siteground then next we need to create a "Cron Job" which is basically an instruction to tell your website to run the above command.

If you're using Siteground then do the following:
  1. Go to:
    Site Tools  >  DEVS  >  Cron Jobs

  2. In the field titled "Command" enter the command you've created

  3. In the field titled "Interval" select "Twice per hour" or select "Manual" and type one of the following:

    * * * * *             (this runs the command every minute, see below)

    0,30 * * * *        (this runs the command every 30 minutes, see below)

    Now regarding the interval duration, Moodle recommends setting this to run the command once per minute but Siteground gave me the following advice:

    "I have noticed that your cron job is set to execute every minute, please note that this setup will generate excess CPU seconds usage on your account due to which it may reach its CPU seconds usage quota and be limited, hence I will strongly recommend setting up this cron job, and future ones, to be executed once every 30 minutes."

    I haven't got a clue what any of that means so I've set it to 30 minutes! Can anyone advise?

  4. Once you've created your command then click on "Manage Notification Emails" and type in the email address you'd like to use. Keep in mind if you've chosen to run the command once per minute then you'll be inundated with emails.

    Check your email and see if you've received an email from "Cron Daemon" (this might be specific to Siteground) and if the email is a long list of executed tasks then your command is working. If you receive an error message in your email instead, e.g. "Could not open input file" then there is a problem with your command line, specifically the path leading to cron.php and you should contact your webhost for advice.

  5. If you want to stop receiving constant emails then edit your command to include >/dev/null at the end, which basically says "stop sending notification emails"


Ok hopefully someone finds the above useful. I have been struggling with this the past few days and figured there might be a few others out there who might benefit from some of the above.

Average of ratings: Useful (1)
In reply to Mike North

Re: Course copying in progress - STUCK

by Sarra Lev -
Sorry, for someone who has no idea what it means to execute a command, can you explain how to do this on MoodleCloud step by step? Thanks. I'm having so much trouble with Moodle these days sad
In reply to Sarra Lev

Re: Course copying in progress - STUCK

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hello Sarra. I don't think you can execute commands on MoodleCloud but if you are having trouble with copying a course on MoodleCloud then I suggest you contact them via your MoodleCloud portal.