Using scp and rync to move files

FTP is usually the best choice for transferring files to a remote computer but sometimes for a single file, scp is an alternative. Use this command.
scp xertetoolkits_3.8.zip jimmy@redmouse.xyz:/home/jimmy/transfer
Once it is in place we can unzip it:
unzip xertetoolkits_3.8.zip
It will create a directory structure but the tree will be under ~/transfer. We need to move it while preserving the file structure. The easiest way is to use rsync with the r ( recursive function)
First:
sudo mkdir /var/www/html/xerte
rsync -r ~/transfer/ /var/www/html/xerte

The command copies all the files to the new directory.
Becoming familiar with these commands is very useful when working in Linux. Don’t worry about remembering the syntax – I often google and copy. What is important is knowing which command to use.

Using ssh to log in to your remote server

ssh is a quick way to log on and access the file system of your server. From the bash shell on WSL, I would use this command.


$ ssh jimmy@redmouse.xyz

The remote server will prompt you for the password. You can skip the password step by installing key-based SSH. ( Note:you will still be able to log on using a password on devices without a key pair).


jimmy@WSLBASH:~$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/jimmy/.ssh/id_rsa):

Enter – accept as default


Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Enter – leave the passphrase as blank


Your identification has been saved in /home/jimmy/.ssh/id_rsa.
Your public key has been saved in /home/jimmy/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:j....lgOkE jimmy@WSLBASH
The key's randomart image is:
+---[RSA 2048]----+
| .=++..+ oE |
...................
| + =|
| = |
+----[SHA256]-----+
jimmy@WSLBASH:~$

Your output should look something like this.
Now you have a private and public key saved in ~/.ssh/
Copy the public key to your server.


ssh-copy-id -i ~/.ssh/id_rsa.pub yourserver.com

Now you should be able to log in using ssh without having to enter a password. No password means you can start using other useful bash commands such as scp and rsync.

Backing up Moodle

If you have students on your Moodle site, you have the responsibility to keep their work safe. Some time ago, while using a cheap VPS, I found my site had simply disappeared. The server was never seen again. Luckily I had course backups manually created and downloaded to my desktop. There were a couple of days old so an embarrassing situation but not critical.

So how should you back up? Automatically, at least daily and with a copy stored in an offsite location. Here is how I do it:

First an automatic course back up. I set this up for around midnight, a time when mos students are finished. The backup creates a .mbz file can be used to restore a course on a different Moodle server. Set this up in:

Site administration -> Courses -> Backups -> Automated backup setup.

Set the schedule to daily, execute time can be left to default ( midnight), and specify the directory to /home/user/backup. You may have to first create this folder manually in Linux.


cd ~
mkdir backup

(The command cd ~ is a shortcut to your home directory ie /home/jimmy/)

Next step is a database dump. You can use the instructions from Moodle docs but there are a few problems with their instructions.


cd /my/backup/directory
mv moodle-database.sql.gz moodle-database-old.sql.gz
mysqldump -h example.com -u myusername --password=mypassword -C -Q -e --create-options mydatabasename > moodle-database.sql
gzip moodle-database.sql

First, the password is exposed in the script, not the best for security. Second, the database backups only go back one day. Finally, the backups are stored on the same server Moodle is running on so failure on the server could wipe Moodle and the backups. I want to suggest a better way – storing up to a week of database dumps, a daily back up offsite, and a daily delete of old files. Here is how to do it.

Chinese names in Moodle

Handling Chinese names is a big problem for those who can’t read characters. Here is how I handle the names of Chinese students in Moodle.
Chinese students usually have a 3 character name with the first character being their family name. It is also common for students to have an “English” name, which is an informal nickname and can change through the year. I am still unsure how Chinese names are sorted but the lists I am given are sorted by a class number ( Student 1 often through Student 60) and this is based on student ID. Chinese do not appear to have the negative connotations of being referred to by a number,
Moodle expects both a first and surname so how do we fit Chinese names into this pattern?
First of all, I use their school issued user id as their Moodle user id. This is a unique number and I will use the student ID to match Moodle grades to school grades. This is the link between the two systems.
Using language customization, I replace the string “First name” with “English name” and “Surname” with Chinese name. I refer to students by their English names while their Chinese names is written in Chinese characters. That displays an English nickname followed by their 3 character Chinese name ie Cary 格兰特. Having both names are useful for both me and the students as I think of them using their English names, their classmates think of them using their Chinese names.
Google translate is able to translate Hanzi into Pinyin so the Chinese characters can be quickly converted to a phonetic spelling.  Moodle provides a field for “First name – phonetic “so this could be added to this field to allow the names to be easily read by someone like myself.

Why use Moodle?

Moodle could be your classroom on the internet. But why should you use Moodle to create your virtual classroom?

Asking what Moodle can do is the wrong question. The right questions are:

  • Which parts of my teaching do I want to improve?
  • How can I be more effective as a teacher?

I currently teach English in China to over 350 students organised into 8 classes and I see them 3 times in two weeks. Some things I wanted to improve:

  • Initial assessment of student ability as individuals and as a class
  • Monitoring of student progress
  • Setting and marking of homework to ensure students maintained good study habits
  • Avoiding total reliance on an end of semester exam

All of these are standard for any teacher and are usually done on paper. However with nearly 60 students in a class marking of student work is onerous and time consuming. Even printing test paper and other resources is difficult – at even 1 page of handout per student per class, I would be printing a 500 page box of paper every week.

What I needed was a low cost way of presenting material and assessing students. It should allow me to base questions on paragraphs of text and avoid the tedium of marking hundreds of submissions each week.

Moodle was the answer for me. My initial use of it was to set and mark homework. In my first semester, I set 10 – 20 questions per week for students to complete outside class and allowed students to repeat the exercise to improve their mark. Each week over 5000 questions had been marked and over the semester, close to 100 000 questions were set, marked and a grade assigned to students. Each homework assignment was marked within seconds and the reasons why it was wrong could be explained to a student.

It was a work load I couldn’t have done manually. I had less than 1 out of 100 students who didn’t complete the majority of the homework and many did the questions over and over to get a perfect score. Students were largely positive and were proud of their scores.

Each teacher has their own set of problems. If many of your problems are due to providing resource material, assessment and grading, then Moodle may improve your teaching.