Register
It is currently Mon Oct 20, 2014 3:38 am

script for copying screenshots to usb-stick


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Sun Dec 28, 2008 2:10 pm   

Joined: Sun Dec 28, 2008 11:05 am
Posts: 2
Dear all,

I need a script for my students to copy the screenshots they made to their memorystick
and emptying the home-directory for the next student.

I'm not that experienced in scripting but just gave it a try. The problem know is that the user-student hasn't the privilige to mount and unmount

Could anybody give me a hand in solving this problem.


Code:
#!/bin/bash

function mounten {   
   clear
   mount -t vfat /dev/sdb1 /mnt
}

function copy {
   clear
   cp /user/*.png /mnt
   echo "De screenshot zijn gekopieerd en worden van het systeem verwijderd"
   rm -f /user/*.png
}

function unmount {
   clear
   umount /mnt
}

function menu {
   clear
   echo
   echo -e "\t\t\tMenu:\n"
   echo -e "\t1. mounten usb-stick"
   echo -e "\t2. copy screenshots"
   echo -e "\t3. unmounten usb-stick"
   echo -e "\t0. exit\n\n"
   echo -en "\t\t\tEnter option:"
   read -n 1 option
}

while [ 1 ]
do
   menu
   case $option in
   0)
      break ;;
   1)
      mounten ;;
   2)
      copy ;;   
   3)
      unmount ;;   
   *)
      clear
      echo "Sorry, wrong selection";;
   esac
   echo -en "\n\n\t\tHit any key to continue"
   read -n 1 line
done
clear   


Top
 Profile  
 PostPosted: Mon Jan 05, 2009 7:11 pm   

Joined: Sun Mar 09, 2008 7:35 pm
Posts: 4
Normal users cannot mount and umount, except if there is:

1) a correct entry in /etc/fstab

or

2) a correct entry in /etc/sudoers


So you have to make some changes at system level to make your script work.


Top
 Profile  
 PostPosted: Mon Jan 05, 2009 7:33 pm   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
3) if the user is in the correct /etc/group

Best regards
Fredrik Eriksson


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP