Generate certificates using bash scripting

(warning)This page is out of date

This page is out of date. For the latest instructions, see the edX documentation.


This how-to explain how to use bash scripting to generate certificates.

Step-by-step guide.

You will run bash script to produce certificate.

  1. Run the command in your open edX instance.

    $ wget https://raw.githubusercontent.com/ariestiyansyah/OpenX/master/certificate-generate.sh
  2. Run the command below.

    $ bash certificate-generate.sh
  3. Code will give an output to insert course id, enter course id you want to generate, for example edX/edX101/2016_Run1
  4. Select Y to generate certificate and N to cancel.
  5. Done.


This is the source code explanation of the steps:

#!/bin/bash
# change directory to edx-platform
cd /edx/app/edxapp/edx-platform

# prompt user, and read command line argument
read -p 'Enter course ID: ' idcourse
read -p "edXius, Are you sure you want to generate the certificate (Y/N)? " answer

# handle the command line argument we were given
while true
do
  case $answer in
   [yY]* ) echo "Okay Darth edXius, Start generating $idcourse "
           sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings production ungenerated_certs -c $idcourse --insecure
           break;;

   [nN]* ) exit;;

   * )     echo "edXius, just enter Y or N, please."; break ;;
  esac
done


Rizky.