#!/bin/bash # J.Kobus 04/2020 ver. 1.00 # last modification: 02/11/2020 if [[ $1 == install ]] then [[ $USER != root ]] && echo "you must be root to install $(basename $0)" && exit cp $0 /usr/local/bin/ chmod +x /usr/local/bin/$(basename $0) exit fi #MAGICK_AREA_LIMIT=10000mb #MAGICK_DISK_LIMIT=100bm #MAGICK_FILE_LIMIT=200 #MAGICK_MEMORY_LIMIT=500mb #MAGICK_MAP_LIMIT=10000mb #MAGICK_THREAD_LIMIT=1 #export MAGICK_AREA_LIMIT MAGICK_DISK_LIMIT MAGICK_FILE_LIMIT MAGICK_MEMORY_LIMIT #export MAGICK_MAP_LIMIT MAGICK_THREAD_LIMIT MAGICK_TIME_LIMIT bold=`tput bold` underline=`tput smul` normal=`tput sgr0` pid=$$ # a teacher should set the following variables asheet= qsheet= #asheet=so-exam-1.txt #qsheet=http://jkob.fizyka.umk.pl/so-exam-1-qs.pdf #server=ameryk.fizyka.umk.pl server=localhost wwwserver=jkob.fizyka.umk.pl ############################################################################################# function help { cat <] start $(basename $0) -d $(basename $0) -g $(basename $0) -d -u [-s ] [-a ] \\ [-q ] [-r ] start $(basename $0) -g -u [-s ] [-a ] \\ [-q ] [-r ] start $(basename $0) clean|cont|install|show|ss|status|stop ${bold}DESCRIPTION${normal} ssctl Bash script can be used to record an exam. It takes, archives and displays snapshots of the whole screen at randomly generated intervals. If dirname or reponame is defined the snapshots are copied into the specified directory on a server together with the exam's answer sheet (if specified). In case reponame is defined the answer sheet is added to repository and then regularily committed and pushed. Programs animate, convert, import, mogrify from the ImageMagick suit are used to make and display screenshots and manipulate the frames. ${bold}COMMANDS${normal} clean remove all ss/*-${import}.${format} files resume|cont continue taking screenshots (and sending them to the repo) every $range seconds (on average) convert merge all *-$import.${format} files into the single ${import}.${format} one install install $(basename $0) in /usr/local/bin/ pause suspend taking snapshots but keep the ssh connection to the server show display the values of several variables: \$user, \$server, \$repo, etc ss begin automatic slideshow; fps variable should be used to adjust the rate of display. start begin taking screenshots every $range seconds (on average) stop stop taking screenshots ${bold}OPTIONS${normal} -a use this option to define the name of a file to be used by students to write down answers to questions published at URL defined by -q option -d "ssh -fN -o ControlPath=$controlPath -M @" is to be executed to establish a master connection which will facilitate the user to login into the server and access the specified directory and to upload screenshots to its ss subdirectory -D