Advertisement
rick1908

udev scanner script

Apr 4th, 2013
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #testing for the word fujitsu because we are only concerned if the scansnap scanner profile is active
  2.  
  3. LocalDisplay=':0'
  4. # Get the username of whoever is at the local X11 display.
  5. # If we don't find one, then exit.
  6. X11User=`who | grep $LocalDisplay | cut -f 1 -d ' '`
  7. if [ -z "$X11User" ] ; then
  8. exit
  9. fi
  10.  
  11. if [ -e "/home/$X11User/.bashrc" ] ; then
  12. source /home/$X11User/.bashrc
  13. fi
  14.  
  15. export DISPLAY=$LocalDisplay
  16. export HOME=/home/$X11User
  17. export XAUTHORITY=/home/$X11User/.Xauthority
  18.  
  19. TEST=`pgrep -f fujitsu`
  20.  
  21. if [ "${TEST:-null}" = null ]; then
  22. su $X11User -c "`gscan2pdf --device='fujitsu:ScanSnap S1500:373683'`" &
  23. else
  24. echo "running, nothing to do"
  25. exit 0
  26. fi
  27. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement