Difference between revisions of "Grab Student Work"
(Created page with ' #!/bin/bash # grab.bash # Author: Murray Saul # Date Created: November 17, 2010 # Date Modified: June 3, 2011 # Purpose: To allow ce admin to "grab" Sunday School wor…') |
|||
Line 65: | Line 65: | ||
cp /home/$x$z/.tuxpaint/saved/* /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null | cp /home/$x$z/.tuxpaint/saved/* /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null | ||
fi | fi | ||
− | + | ||
if [ "$y" = "wordProcessing" ] | if [ "$y" = "wordProcessing" ] | ||
then | then | ||
Line 75: | Line 75: | ||
cp /home/$x$z/Documents/*.pdf /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null | cp /home/$x$z/Documents/*.pdf /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null | ||
fi | fi | ||
− | + | ||
if [ "$y" = "slideShows" ] | if [ "$y" = "slideShows" ] | ||
then | then | ||
Line 83: | Line 83: | ||
cp /home/$x$z/Documents/*.ppt /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null | cp /home/$x$z/Documents/*.ppt /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null | ||
fi | fi | ||
− | + | ||
done | done | ||
− | + | ||
chown teacher:teacher ./* | chown teacher:teacher ./* | ||
− | + | ||
if zenity --question --text "Do you want to delete all <b>$y</b> that you \"grabbed\"?" | if zenity --question --text "Do you want to delete all <b>$y</b> that you \"grabbed\"?" | ||
then | then | ||
Line 96: | Line 96: | ||
rm /home/$x$z/.tuxpaint/saved/* 2> /dev/null | rm /home/$x$z/.tuxpaint/saved/* 2> /dev/null | ||
fi | fi | ||
− | + | ||
if [ "$y" = "wordProcessing" ] | if [ "$y" = "wordProcessing" ] | ||
then | then | ||
Line 103: | Line 103: | ||
rm /home/$x$z/Documents/*.pdf 2> /dev/null | rm /home/$x$z/Documents/*.pdf 2> /dev/null | ||
fi | fi | ||
− | + | ||
if [ "$y" = "slideShows" ] | if [ "$y" = "slideShows" ] | ||
then | then | ||
Line 109: | Line 109: | ||
rm /home/$x$z/Documents/*.ppt 2> /dev/null | rm /home/$x$z/Documents/*.ppt 2> /dev/null | ||
fi | fi | ||
− | + | ||
done | done | ||
fi | fi |
Latest revision as of 09:59, 22 June 2011
#!/bin/bash # grab.bash # Author: Murray Saul # Date Created: November 17, 2010 # Date Modified: June 3, 2011 # Purpose: To allow ce admin to "grab" Sunday School work # to be placed on USB device to take home. Copy of # word also placed on "Sunday_School" directory for # extra backup... # Determine USB device Name # Prompt for user account zenity --info --text "WELCOME TO GRAB WORK!\n\nThis program will allow instructors to \"grab\" student work on the computer lab. The instructor then has the option to remove \"grabbed\" work, and to automatically copy work on the instructor's USB stick.\n\nPlease click OK to continue." zenity --info --text "PLEASE INSERT YOUR USB STICK INTO THE SERVER.\n\nAfter you have inserted your USB device, then click OK to continue." sleep 3 set $(ls /media | sed "s/ /_/g" | sed "s/^/FALSE &/") > /dev/null content=$* usbChoice=$(zenity --title "Select USB Device" --list --text "Please select your USB device:" --radiolist --column "Pick" --column "USB Name" $content) usbDriveName="$(echo $usbChoice | sed "s/_/ /g")" dateStamp=$(date +"%d_%B_%y") timeStamp=$(date +"%H_%M_%S_%p") cd /media pwd cd "${usbDriveName}" mkdir -p churchLab/$dateStamp/$timeStamp 2> /dev/null mkdir -p /home/teacher/churchLab/$dateStamp/$timeStamp 2> /dev/null sudo chown teacher:teacher /home/teacher/churchLab/$dateStamp/$timeStamp cd churchLab/$dateStamp/$timeStamp account=$(zenity --height 250 --text "Select Computer Accounts to \"Grab Work\" From:" --list --checklist --column "" --column "Computer Account" FALSE jamm FALSE studio ) set $(echo $account | tr '|' ' ') > /dev/null for x do # Prompt for application to yank for each account application=$(zenity --height 350 --text "Select applications to grab for\naccount called \"$x\":" --list --checklist --column "" --column "Application" FALSE tuxpaintings FALSE wordProcessing FALSE slideShows ) set $(echo $application | tr '|' ' ') > /dev/null for y do for ((z=1;z<=7;z++)) do if [ "$y" = "tuxpaintings" ] then cp /home/$x$z/.tuxpaint/saved/* . 2> /dev/null cp /home/$x$z/.tuxpaint/saved/* /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null fi if [ "$y" = "wordProcessing" ] then cp /home/$x$z/Documents/*.doc . 2> /dev/null cp /home/$x$z/Documents/*.doc /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null cp /home/$x$z/Documents/*.odt . 2> /dev/null cp /home/$x$z/Documents/*.odt /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null cp /home/$x$z/Documents/*.pdf . 2> /dev/null cp /home/$x$z/Documents/*.pdf /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null fi if [ "$y" = "slideShows" ] then cp /home/$x$z/Documents/*.odp . 2> /dev/null cp /home/$x$z/Documents/*.odp /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null cp /home/$x$z/Documents/*.ppt . 2> /dev/null cp /home/$x$z/Documents/*.ppt /home/teacher/Desktop/churchLab/$dateStamp/$timeStamp 2> /dev/null fi done chown teacher:teacher ./* if zenity --question --text "Do you want to delete all $y that you \"grabbed\"?" then for ((z=1;z<=7;z++)) do if [ "$y" = "tuxpaintings" ] then rm /home/$x$z/.tuxpaint/saved/* 2> /dev/null fi if [ "$y" = "wordProcessing" ] then rm /home/$x$z/Documents/*.doc 2> /dev/null rm /home/$x$z/Documents/*.odt 2> /dev/null rm /home/$x$z/Documents/*.pdf 2> /dev/null fi if [ "$y" = "slideShows" ] then rm /home/$x$z/Documents/*.odp 2> /dev/null rm /home/$x$z/Documents/*.ppt 2> /dev/null fi done fi done done zenity --info --text "GRAB COMPLETED!\n\nPlease verify that you properly "grabbed" this work by checking the date and timestamp subfolders contained in the churchLab Desktop folder.\n\nPlease safely remove your USB storage device now...\n\nHave a nice day... and thank you for using GRAB WORK!\n\n"