Don't like ads? PRO users don't see any ads ;-)
Guest

0day

By: a guest on Apr 30th, 2012  |  syntax: Bash  |  size: 1.33 KB  |  hits: 57  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. #iblicf
  3.  
  4. Tracker="http://tracker.sjtu.edu.cn/announce.php"
  5. watchdir="/root/rtorrent/session"
  6. _0day=$(basename "$PWD")
  7.  
  8. which mktorrent &>/dev/null || exit
  9. which unrar &>/dev/null || exit
  10.  
  11. if [ ! -e *.rar ]; then
  12.         echo -e "\tThere have no 0day's *.rar ~~~"
  13.         exit
  14. fi
  15.  
  16. [ -z "$1" ] || Tracker=$1
  17.  
  18. echo  "============================================================"
  19. echo  "Name:    $_0day"
  20. echo  "Tracker: $Tracker"
  21. echo  "============================================================"
  22.  
  23. if [ -d ./temp ];then
  24.         #rm -rf ./temp/*
  25.         echo -e "\tCaution: already has <temp> folder!"
  26.         exit   
  27. else
  28.         mkdir -p "./temp/$_0day"
  29.         echo -e "\n\t1) Unrar ing..."
  30.         unrar -o+ -c- x *.rar "./temp/$_0day/" #&>/dev/null
  31.  
  32.         if [ $? -ne 0 ]; then
  33.                 echo -e "\tSomething wrong while doing unrar ~~~"
  34.                 exit
  35.         fi
  36. fi
  37.  
  38. [ "$?" -eq 0 ] || echo -e "\tWhat??? ~~~"
  39.  
  40.  
  41.  
  42. if [ -d "./temp/$_0day" ]; then
  43.         cp *.nfo "./temp/$_0day/" &>/dev/null
  44.         pushd ./temp &>/dev/null
  45.         rm -rf *.torrent
  46.         echo -e "\n\t2) Now make torrent ..."
  47.         mktorrent -p -a $Tracker $_0day
  48.         popd &>/dev/null
  49. else
  50.         echo -e "\tno mktorrent!"
  51. fi
  52.  
  53. wait
  54.  
  55. #echo -e "\t$DIRSTACK"
  56. mv -f ./temp/$_0day/* . &>/dev/null
  57. cp -f ./temp/*.torrent . &>/dev/null
  58. rm -rf ./temp &>/dev/null
  59. #cp ./temp/*.torrent $Watch_dir
  60.  
  61. echo -e "\n\t***WE DONE!!!***"