Binomico

pyLoad unrar_finished

Apr 2nd, 2011
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.48 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ########################################################################
  4. # UNRAR_FINISHED: RENAMING FILENAMES AND SENDING TO DESIRED FOLDER
  5.  
  6. PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin
  7. SCRP="/volume1/public/scripts" #where runscript.sh is located
  8. URSRP=/share/Public/unrarall
  9. prefix=/share/Public
  10.  
  11.  
  12. UF_FOLDER=$1
  13. export UF_FOLDER
  14. export SCRP
  15.  
  16. #---------------------------------------------------------------
  17. # -----------remove # to enable logging
  18. #---------------------------------------------------------------
  19.  
  20. LOG={$prefix}/pyload_finished.txt #replace with your desired path
  21. echo START arguments unrar_finished >>$LOG
  22. echo "$0 0 scriptname" >>$LOG
  23. echo "$1 1. argument" >>$LOG
  24. echo "$2 2. argument" >>$LOG
  25. echo "$# arguments rendered" >>$LOG
  26. echo STOP arguments unrar_finished >>$LOG
  27.  
  28.  
  29. ########################################################################
  30. # check if unrar is active and wait till unrar of all files is done
  31.  
  32. cd "$UF_FOLDER"
  33.   for FILE in `ls -1 *.rar`
  34.     do
  35.       while [ -f "$FILE" ]
  36.         do
  37.          sleep 8
  38.         done
  39.     done
  40.  
  41.  
  42. ########################################################################
  43. # start the main renaming script
  44.  
  45. sleep 5
  46. cp $SCRP/runscript.sh "$UF_FOLDER/"
  47. cd "$UF_FOLDER"
  48. ./runscript.sh &
  49.  
  50.  
  51. sleep 20
  52.  
  53. cat "$UF_FOLDER/runscript.sh" ; echo $?
  54.  if [ "$?" == "0" ]; then
  55.   kill -9 $$
  56.  fi
  57.  
  58. exit 0
  59.  
  60. ########################################################################
  61. # end of script
Advertisement
Add Comment
Please, Sign In to add comment