% CentOS: Remote Checking, Marking, and Submitting your Work % Ian! D. Allen – – [www.idallen.com] % Winter 2015 - January to Apil 2015 - Updated Sun Apr 12 05:22:52 EDT 2015 Introduction to CentOS Marking ============================== The **Checking Program** that verifies your CentOS work resides on the [Course Linux Server], but your work is on your [CentOS Virtual Machine]. To mark your work, we need to transfer information from your CentOS VM to the CLS for marking. To do this, there is a **Fetch** program that you must download and use on your CentOS Virtual Machine to copy information from your CentOS Virtual Machine to your account on the CLS so that the **Checking Program** can check it on the CLS. Once the **Fetch** program has transferred this information from your CentOS Virtual Machine to the CLS, you can run the **Checking Program** on the CLS to check what is saved there. When you make changes on your CentOS Virtual Machine, you need to run the **Fetch** program again on CentOS to update the saved files on the CLS. Simply running the **Checking Program** on the CLS will *not* update the saved files on the CLS. You must run the **Fetch** program on your CentOS VM when you make changes there. As a convenience, the **Fetch** program not only transfers information from your CentOS VM to the CLS for marking, it also runs the **Checking Program** on the CLS for you. Part I – Download the Fetch Program into CentOS =============================================== - Do all the following steps on your [CentOS Virtual Machine]. - Read through the whole sequence before you start typing anything. - An example of what to type is given below the descriptions that follow. - You only need to download this Fetch program once per assignment. - You can run the downloaded **Fetch** program as many times as you like. If you have created your personal sysadmin account, choose the first method. If you only have a `root` account, choose the second method. Method 1: Download Fetch using your Sysadmin Account ---------------------------------------------------- Use this method to download the **Fetch** program if you have created your personal sysadmin (non-`root`) account on CentOS. (This is the preferred method.) 1. Log in to CentOS using your personal sysadmin non-`root` account (same userid as Blackboard). 2. If necessary, create a **Base Directory** in your CentOS sysadmin account named for your course, term, and assignment number, e.g. *CST0001-15W/Assignments/assignmentNN* where *CST0001* is your course number and *NN* is your assignment number, e.g. `assignment99` for Assignment 99. **Use the current assignment number, not `99`.** This is your CentOS **Base Directory** for this assignment. 3. Change to the above CentOS **Base Directory**. 4. As shown below, use `curl` to get a copy of the **Fetch** program from the given URL into a file named `do.sh`. In the URL below: - replace `cst0001` with your course number (lower-case) - replace `NN` with your assignment number (two digits). 5. Make sure you have a file named `do.sh` in your **Base Directory**. 6. **Warning:** If you printed this page on paper, you may not be able to scroll right to read the whole web URL that you must pass to the `curl` program. Here is an example for course *CST0001* and assignment number *99* (you must use your actual course, actual assignment number, and your own userid values): $ whoami ; hostname ; pwd abcd0001 # your userid, not abcd0001 abcd0001 # your userid, not abcd0001 /home/abcd0001/CST0001-15W/Assignments/assignment99 # do not use 0001 or 99 $ url=http://teaching.idallen.org/cst0001/15w/notes/data/assignment99do.sh [... make sure you scroll right to read the full web URL above ...] $ curl -A mozilla "$url" >do.sh [... various download statistics print here ...] Do *not* use `CST0001`, `cst0001`, `assignment99`, or `abcd0001`; use the real values from your own course, assignment, and userid. Skip forward to “Part II – Verify the Fetch Program”. Method 2: Download Fetch using the `root` Account ------------------------------------------------- Use this method to download the **Fetch** program only if you have *not yet* created your personal sysadmin account on CentOS. If you have your own sysadmin account, use the previous method instead. 1. Log in to CentOS using the `root` account. 2. Create a directory in the HOME directory of the `root` account named for your course, term, and assignment number, e.g. *CST0001-15W/Assignments/assignmentNN* where *CST0001* is your course number and *NN* is your assignment number, e.g. `assignment99` for Assignment 99. This is your CentOS **Base Directory** for this assignment. 3. Change to the above CentOS **Base Directory**. 4. As shown below, use `curl` to get a copy of the **Fetch** program from the given URL into a file named `do.sh`. In the URL below: - replace `cst0001` with your course number (lower-case) - replace *NN* with your assignment number (two digits). 5. Make sure you have a file named `do.sh` in your **Base Directory**. 6. **Warning:** If you printed this page on paper, you may not be able to scroll right to read the whole web URL that you must pass to the `curl` program. Here is an example for course *CST0001* and assignment number *99* (you must use your actual course, assignment, and userid values): # whoami ; hostname ; pwd root abcd0001 # your userid, not abcd0001 /root/CST0001-15W/Assignments/assignment99 # do not use 0001 or 99 # url=http://teaching.idallen.org/cst0001/15w/notes/data/assignment99do.sh [... make sure you scroll right to read the full web URL above ...] # curl -A mozilla "$url" >do.sh [... various download statistics print here ...] Do *not* use `CST0001`, `cst0001`, `assignment99`, or `abcd0001`; use the real values from your own course, assignment, and userid. Part II – Verify the Fetch Program ================================== 1. Make sure you are in the **Base Directory** for the assignment where you downloaded the `do.sh` program for this assignment. 2. Read (using `less do.sh`) and verify that the text file `do.sh` is a short shell script that contains a URL for the **Fetch** program with the current assignment number in it. 3. If you read things such as `Error 404 - page not found` in the `do.sh` file then fix your typing mistakes and try again. Here is an example for course *CST0001* and assignment number *99* (you must use your actual course and assignment numbers): $ curl -A mozilla "$url" >do.sh # $url was set in Part I [... various download statistics print here ...] $ file do.sh do.sh: POSIX shell script text executable # see below if different $ fgrep 'fetch.sh' do.sh http://"$GO"/cst0001/15w/notes/data/assignment99fetch.sh If `file` doesn’t say it’s a shell script, or the `fgrep` does not find the `notes/data` URL for the current course and assignment number in the `do.sh` file: a. Read the `do.sh` file to see if there are any errors that need fixing. The usual cause is typing mistakes in the `URL`. Do *not* use `cst0001` or `assignment99`; use the real values for your course for the current term and assignment. b. Fix the errors and re-run the Part I and II until you get a `do.sh` file containing the correct **fetch** shell script for your course and assignment number. You only need to download this `do.sh` **Fetch** program *once* per assignment. Every assignment has its own separate `do.sh` file to download. Part III – Run the `do.sh` Fetch Program ======================================== - You must have a verified copy of the `do.sh` **Fetch** program for the current assignment in your CentOS **Base Directory** to continue with this section. - Your current directory must be the CentOS assignment **Base Directory**. - You must run the `do.sh` script as `root` with the `USER` environment variable set to your own CLS account userid, as shown below. - Failure to **read all the words** will lock your account out of the CLS. If you have created your personal sysadmin account and enabled the `sudo` command, choose the first method. If you only have a `root` account, or if you don’t have `sudo` working, choose the second method. Method 1: Run `do.sh` using your Sysadmin Account and `sudo` ------------------------------------------------------------ Use this method to run the `do.sh` **Fetch** program if you have created your personal sysadmin account and enabled the `sudo` command. If you only have a `root` account, or if you don’t have `sudo` working, choose the second method. 1. Log in to CentOS as your personal sysadmin account. 2. Change directories to the **Base Directory** for the assignment where you downloaded the `do.sh` program for this assignment. 3. As shown below, use `sudo` and `sh` to run the `do.sh` script in the current directory as `root`, with the `USER` environment variable set to your own CLS account userid: Example (use your own CLS userid, not *abcd0001*): $ whoami abcd0001 $ file do.sh do.sh: POSIX shell script text executable $ sudo USER=abcd0001 sh do.sh # use your *own* userid *not* abcd0001 - Use your own CLS userid, not the sample text *abcd0001*. - Failure to set the `USER=` variable to your correct CLS userid as shown above will cause your account to be locked out of the CLS. (You can also use `USER=$USER` to set the `USER` variable with `sudo`.) Method 2: Run `do.sh` without using `sudo` ------------------------------------------ Use this method to run the `do.sh` **Fetch** program if you *have not* created your personal sysadmin account or if you *have not* enabled the `sudo` command. If you have your own sysadmin account and a working `sudo`, choose the previous method. 1. Become the `root` user: Log in as `root` or else use `su` to become the `root` user. 2. Change directories to the **Base Directory** for the assignment where you downloaded the `do.sh` program for this assignment. 3. As shown below, use `sh` to run the `do.sh` script in the current directory as `root`, with the `USER` environment variable set to your own CLS account userid: Example (use your own CLS userid, not *abcd0001*): # whoami root # file do.sh do.sh: POSIX shell script text executable # USER=abcd0001 sh do.sh # use your *own* userid *not* abcd0001 - Use your own CLS userid, not the sample text *abcd0001*. - Failure to set the `USER=` variable to your correct CLS userid as shown above will cause your account to be locked out of the CLS. Part IV – Answering The Fetch Program ===================================== > If you see errors when you run the `do.sh` script, you probably skipped > over **Part II** above. Go back and verify the script. You must have a > verified script before you can run it. When you successfully run the `do.sh` script that calls the **Fetch** program, it will look similar to the text below and you will need to answer two questions: 1. If you are on-campus, you may answer `y` to use the CLS local IP address instead of the public address. 2. You will need to enter your CLS password to allow the **Fetch** program to transfer information from CentOS to your account on the CLS for marking. Here is an example for course *CST0001* and assignment number *99* (you must use your actual course, assignment, and userid values): # USER=abcd0001 sh do.sh --------------------------------------------------------------------------- abcd0001: FETCH version 3. Connecting to CLS as USER='abcd0001' using ssh --------------------------------------------------------------------------- abcd0001: Use local Algonquin IP cst0001-alg.idallen.ca [y/N/?]? n abcd0001: Please wait; using ssh to connect to user 'abcd0001' on cst0001.idallen.ca ... *** COURSE LINUX SERVER *** abcd0001@cst0001.idallen.ca's password: # enter your CLS password --------------------------------------------------------------------------- idallen-ubuntu assignment99fetch_server.sh version 8 run by abcd0001. Please wait; collecting info from abcd0001 Virtual Machine --------------------------------------------------------------------------- VM files collected into CST0001-15W/Assignments/assignment99/abcd0001.tar.bz on CLS. Now running checking program for abcd0001 on CLS: [... checking program output appears here ...] Notes on the Fetch program -------------------------- - This `do.sh` script runs a **Fetch** program that will connect from your CentOS machine to the CLS using your account name set in the `USER` variable. - The **Fetch** program will copy information from your CentOS VM into a `root`-owned `tar` archive in your assignment **Base Directory** on the CLS. You can not read the contents of this archive. Do not delete it from the CLS. - The **Fetch** program will then run the checking program on the CLS to check the contents of the `tar` archive on the CLS. You will need to answer one question about your IP address, and then wait and type in your CLS password, as shown above. - The checking program run at the end of the **Fetch** program is always running on the CLS, not on your CentOS VM. - When the checking program starts, it will issue a few messages relevant to your account on the CLS (e.g. errors in your CLS `.bashrc` file or world-writable files on the CLS). These errors are on the CLS, not on your CentOS machine. - You may also log in to the CLS and run the checking program on the CLS, instead of using the **Fetch** program. If you only run the checking program on the CLS, it won’t update the `tar` archive with new information from your CentOS VM; it will just check the existing `tar` archive. The checking program will warn you if you are checking an old `tar` archive. Part V – Final Check and Submit =============================== **Summary:** Do some tasks, then run the **Fetch** and checking program to verify your work as you go. You can run the **Fetch** and checking program as often as you want. When you have the best mark, upload the marks file to Blackboard. > Since I also do manual marking of student assignments, your final mark may > not be the same as the mark submitted using the current version of the > **Checking Program**. I do not guarantee that any version of the **Checking > Program** will find all the errors in your work. Complete your assignments > according to the specifications, not according to the incomplete set of the > mistakes detected by the **Checking Program**. When you are done with your assignment and want to submit your marks, you need to run the checking program one last time on the CLS (not from CentOS) and submit the output file from the CLS, as follows: Do all this on the [Course Linux Server] when you are ready to submit: - Use your own CLS userid, not the sample text *abcd0001*. - Use your own assignment number, not the sample text *assignment99*. - Use your own course number, not the sample text *cst0001*. 1. Log in to the CLS. Go to your assignment **Base Directory** on the CLS. 2. There is a **Checking Program** named `assignment`*NN*`check` in the assignment **Source Directory** on the CLS, where *NN* is replaced by your current assignment number, e.g. `assignment99check` for Assignment 99. **Use the current assignment number, not `99`.** Create a [Symbolic Link] to this program named `check` under your assignment **Base Directory** on the CLS so that you can easily run the program to check your work and assign your work a mark on the CLS. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file. 3. Execute the above “check” program on the CLS using its symbolic link. (Review the [Search Path] notes if you forget how to run a program by pathname from the command line.) This program will check your fetched CentOS work from the latest `tar` archive, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.) You may run the `check` program as many times as you wish, to correct mistakes and get the best mark. **Some task sections require you to finish the whole section before running the checking program at the end; you may not always be able to run the checking program successfully after every single task step.** > Remember: The checking program run on the CLS does not fetch new files to > the CLS from your CentOS VM. You must run the **Fetch** program on your > CentOS VM to update the `tar` archive on the CLS so that the checking > program can mark the latest CentOS information. 4. When you are done with this assignment, and you like the mark displayed on your screen by the **Checking Program**, you must **redirect** only the standard output of the **Checking Program** into the text file `assignment`*NN*`.txt` in your **Base Directory** on the CLS, where *NN* is replaced by your current assignment number, e.g. `assignment99.txt` for Assignment `99`. **Use the current assignment number, not `99`.** - Redirect only the standard output of the [Checking Program]. - Use that *exact* name. Case (upper/lower case letters) matters. - Be absolutely accurate, as if your marks depended on it. - Do not edit the output file. - Make sure the file actually contains the output of the **Checking Program**! - The file should contain, near the bottom, a line starting with: `YOUR MARK for` - Really! **MAKE SURE THE FILE HAS YOUR MARKS IN IT!** 5. Transfer the above single file `assignment`*NN*`.txt` (containing the output from the **Checking Program**) from the CLS to your local computer. - You may want to refer to the [File Transfer] page for how to transfer the file. - Verify that the file still contains all the output from the **Checking Program**. - Do not edit this file! No empty files, please! Edited or damaged files will not be marked. Submit the file exactly as given. - The file should contain, near the bottom, a line starting with: `YOUR MARK for` - Really! **MAKE SURE THE FILE YOU UPLOAD HAS YOUR MARKS IN IT!** 6. Upload the `assignment`*NN*`.txt` file from your local computer to the correct Assignment area on Blackboard (with the exact name) before the due date: 1. On your local computer use a web browser to log in to Blackboard and go to the Blackboard page for this course. 2. Go to the Blackboard *Assignments* area for the course, in the left side-bar menu, and find the current assignment. 3. Under *Assignments*, click on the underlined **assignment***NN* link for this assignment. a) If this is your first upload, the *Upload Assignment* page will open directly; skip the next sentence. b) If you have already uploaded previously, the *Review Submission History* page will be open and you must use the *Start New* button at the bottom of the page to get to the *Upload Assignment* page. 4. On the *Upload Assignment* page, scroll down and beside *Attach File* use *Browse My Computer* to find and attach your assignment file from your local computer. Make sure the assignment file has the correct name on your local computer before you attach it. 5. After you have attached the file on the *Upload Assignment* page, scroll down to the bottom of the page and use the *Submit* button to actually upload your attached assignment file to Blackboard. Use only *Attach File* on the *Upload Assignment* page. Do not enter any text into the *Text Submission* or *Comments* boxes on Blackboard; I do not read them. Use only the *Attach File* section followed by the *Submit* button. If you need to comment on any assignment submission, send me [EMail]. You can revise and upload the file more than once using the *Start New* button on the *Review Submission History* page to open a new *Upload Assignment* page. I only look at the most recent submission. You must upload the file with the correct name from your local computer; you cannot correct the name as you upload it to Blackboard. 7. **Verify that Blackboard has received your submission**: After using the *Submit* button, you will see a page titled *Review Submission History* that will show all your uploaded submissions for this assignment. Each of your submissions is called an *Attempt* on this page. A drop-down list of all your attempts is available. a) Verify that your latest *Attempt* has the correct 16-character, lower-case file name under the *SUBMISSION* heading. b) The one file name must be the *only* thing under the *SUBMISSION* heading. Only the one file name is allowed. c) No *COMMENTS* heading should be visible on the page. Do not enter any comments when you upload an assignment. d) **Save a screen capture** of the *Review Submission History* page on your local computer, showing the single uploaded file name listed under *SUBMISSION*. If you want to claim that you uploaded the file and Blackboard lost it, you will need this screen capture to prove that you actually uploaded the file. (To date, Blackboard has never lost an uploaded file.) You will also see the *Review Submission History* page any time you already have an assignment attempt uploaded and you click on the underlined **assignment***NN* link. You can use the *Start New* button on this page to re-upload your assignment as many times as you like. You cannot delete an assignment attempt, but you can always upload a new version. I only mark the latest version. 8. Your instructor may also mark files in your directory in your CLS account after the due date. Leave everything there on the CLS. **Do not delete any assignment work from the CLS until after the term is over!** - I do not accept any assignment submissions by EMail. Use only the Blackboard *Attach File*. No word processor documents. Plain Text only. - Use the *exact* file name given above. Upload only one single file of Linux-format plain text, not HTML, not RTF, not MSWord. No fonts, no word-processing. Linux plain text only. - **NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.** - No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact 16-character, lower-case name given above. - **WARNING:** Some inattentive students don’t read all these words. Don’t make that mistake! Be exact. **READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!** -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/ [Plain Text] - plain text version of this page in [Pandoc Markdown] format [www.idallen.com]: http://www.idallen.com/ [Course Linux Server]: ../../../cst8207/15w/notes/070_course_linux_server.html [CentOS Virtual Machine]: ../../../cst8207/15w/notes/000_centos_install.html [Symbolic Link]: ../../../cst8207/15w/notes/460_symbolic_links.html [Search Path]: ../../../cst8207/15w/notes/400_search_path.html [File Transfer]: ../../../cst8207/15w/notes/015_file_transfer.html [EMail]: mailto:idallen@idallen.ca [Plain Text]: 000_centos_marking.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/