Skip to content

Instantly share code, notes, and snippets.

@horaciod
Created August 8, 2019 22:24
Show Gist options
  • Save horaciod/2d2fb2cf28a34c485b0e01faa132d0f7 to your computer and use it in GitHub Desktop.
Save horaciod/2d2fb2cf28a34c485b0e01faa132d0f7 to your computer and use it in GitHub Desktop.
moodle enroll all students from on course to another using moosh https://moosh-online.com/commands/
#!/bin/bash
# dos parámetros / two parameters
# ex. ./enrolldecurso_a_curso.sh --id 20 715
# $1 curso orign $2 curso destino
# ### path of the moodle root
cd /datos/webs/moodle36/html
#export curso
php /home/desarrollo/moosh/moosh.php user-list --course=$1 --id >/tmp/exportados.txt
#exit 111
echo '---------------------';
for i in `cat /tmp/exportados.txt`
do
# echo '-----------------------' >> /home/desarrollo/enrollinfo.txt;
echo "Course ID destino : $2 enroll al user $i" ;
php /home/desarrollo/moosh/moosh.php course-enrol --id $2 $i
done
cat /home/desarrollo/enrollinfo.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment