Print

Print


Your syntax is just a wee bit off. Note the ` instead of ' and you don't need ; after the actual commands.


I used the keyword line because I always do!


#!/bin/bash

   for line in `cat courses_backup.txt`;
   do
        echo "course ID in que: $i"
        moosh -n course-backup $line
   done


Steve Baxter
IS Programmer



From: List dedicated to technical discussions about Moodle <[log in to unmask]> on behalf of Heather Peake <[log in to unmask]>
Sent: 25 May 2017 09:28
To: [log in to unmask]
Subject: Re: Moosh - gradebook
 
Hi

Please be aware that it does not work properly and is for the course backup and I had a lot of help getting this far!

This is the script:-
        #! /bin/bash -x

        for i in 'cat ./courses_backup.txt'
        do
        echo "course ID in que: $i";
        moosh -n course-backup $i
        done

And the text file it calls simply has
        1
        2
        3

I tried them as space separated numbers as well as carriage return separated numbers and they still don't work properly.

The course backup we probably have about 1000 courses hence the need to automate it. The gradebook - well I'm nowhere yet!

Regards

Heather Peake
VLE Development Co-ordinator

T: 01623 627191 ex 8564

-----Original Message-----
From: Fred Crowson [mailto:[log in to unmask]]
Sent: 25 May 2017 09:12
To: List dedicated to technical discussions about Moodle <[log in to unmask]>
Cc: Heather Peake <[log in to unmask]>
Subject: RE: Moosh - gradebook

Hi Heather,

Can you share the script that you are using?

Cheers

Fred
Fred Crowson
Learning Technologist
+44 (0)141 270 8285 (direct)
[log in to unmask]
________________________________________
From: List dedicated to technical discussions about Moodle [[log in to unmask]] on behalf of Heather Peake [[log in to unmask]]
Sent: 25 May 2017 08:58
To: [log in to unmask]
Subject: Moosh - gradebook

Hello
I'm looking to use Moosh on an Ubuntu server to backup / download the gradebook including uploaded assessments. Unfortunately I have little to no scripting skills and limited ubuntu skills. Has anyone done this? If yes can you share what you did or point me in the right direction? I'm on a Moodle 3.

I've got the Moosh installed on a test system and I can use it with the included commands to get one course backup at a time. I've had a go at making it into a script to pass a file to in order to do a group of back ups, but so far it seems to not like my file of course numbers and tells me I have to many arguments... This one I think given long enough I can probably work out - but the grade book, not a clue really although when I look at the course backup command file I can see a section in it about grades and was wondering if it could be pulled out and run separately, but my skill set is really not up to it.
Any thoughts? Any suggestions much appreciated.

Thanks
Heather

______________________________________________________________________
This email has been scanned for viruses by Symantec.cloud

Please consider the environment by not printing this email
______________________________________________________________________