pebriana

CopyFlash Temp

May 25th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.60 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. args=("$@")
  4.  
  5. args=`echo $args | sed 's/[/]$//'`
  6.  
  7. pids=`eval pgrep -f flashplayer`
  8. for pid in $pids
  9. do
  10. lsoutput=$(lsof -p $pid | grep '/tmp/Flash[^ ]*')
  11.  
  12. IFS=$'\n'
  13. for line in $lsoutput; do
  14. lsout1=`echo $line | awk '{print "/proc/" $2 "/fd/" $4}' | sed 's/[rwu]$//'`
  15. lsout2=`echo $line | awk '{print $9}' | awk -F '/' '{print $3}'`
  16.  
  17. if [ -n "$args" ];then
  18. if [ -d $args ]; then
  19. echo "Copying $lsout2 to $args/"
  20. eval "cp $lsout1 $args/$lsout2.flv"
  21. else
  22. echo "The directory \"$args\" doesn't exist"
  23. break
  24. fi
  25. else
  26. echo "Copying $lsout2"
  27. eval "cp $lsout1 $lsout2.flv"
  28. fi
  29.  
  30. done
  31. done
Add Comment
Please, Sign In to add comment