Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
1,350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #---------- config start----------
  4. username="username"
  5. password="password"
  6. server="newsserver"
  7. temppath="path of temp dir used to post material es: /media/dati/"
  8. newsgroup="newsgroup, es: alt.binaries.multimedia.divx.italian"
  9. poster="poster name, es: poster"
  10. email="email address, es: poster@gmail.com"
  11. #---------- config end----------
  12.  
  13.  
  14. error="false"
  15. filename="$(basename $1)"
  16. subject="${filename%.*}"
  17.  
  18.  
  19.  
  20. function checkLastCommand {
  21. if [ "$1" != "0" ]; then
  22. error="true"
  23. fi
  24. }
  25.  
  26. #rar split of file
  27. rar a "$temppath$filename" -v40m -m0 $1
  28.  
  29. #checkresult
  30. checkLastCommand "$?"
  31.  
  32. #create par
  33. if [ "$error" != "true" ]; then
  34. par2create -r10 -n7 "$temppath$filename" "$temppath"*.rar*
  35. fi
  36.  
  37. #checkresult
  38. checkLastCommand "$?"
  39.  
  40. #post
  41. if [ "$error" != "true" ]; then
  42. newspost -i "$server" -u "$username" -p "$password" -f "$email" -n "$newsgroup" -y -s "$subject" "$temppath"*
  43. fi
  44.  
  45. #checkresult
  46. checkLastCommand "$?"
  47.  
  48. #delete tmpfile
  49. if [ "$error" != "true" ]; then
  50. rm "$temppath"*
  51. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement