/cistromescripts/create_aspera_accounts.sh

https://bitbucket.org/cistrome/cistrome-harvard/ · Shell · 59 lines · 29 code · 17 blank · 13 comment · 1 complexity · 1805c42489e47df75eebb1aedfa39aaa MD5 · raw file

  1. #!/bin/bash
  2. # This script can create a folder under aspera directory according to
  3. # user's name, then send confirmation emails to both the user and
  4. # cistrome admin team.
  5. if [ $# -lt 2 ]; then
  6. echo "need 1 para: <username> <this week password>!"
  7. exit
  8. fi
  9. # Modify these according to your server
  10. # ASPERA directory path on server
  11. ASPERA_DIR=/data/CistromeAP/ap_lib/ftp
  12. # ASPERA user name
  13. ASPERA_USER=cistromeap
  14. # ASPERA host name
  15. ASPERA_HOST=cistrome.org
  16. # ASPERA web interface URL
  17. ASPERA_WEB=http://cistrome.org/aspera/user
  18. # cistrome contact email address, a notification email will be BCCed to this email address
  19. CISTROME_CONTACT=cistrome-bugs@jimmy.harvard.edu
  20. # cistrome bugs email address, we will suggest users in the mail body to send questions/feedbacks to this email address.
  21. CISTROME_BUGS=cistrome-bugs@jimmy.harvard.edu
  22. # create folder for cistrome user under aspera path
  23. mkdir ${ASPERA_DIR}/${1}
  24. chown -R ${ASPERA_USER} ${ASPERA_DIR}/${1}
  25. # send email to both admin and user
  26. sendmail ${1} ${CISTROME_CONTACT} <<EOF
  27. From: ${USER}@${ASPERA_HOST}
  28. Subject: [cistrome] Your ASPERA upload directory is ready to use. (Do Not Reply)
  29. To: ${1}
  30. BCC: ${CISTROME_CONTACT}
  31. Hi ${1},
  32. Please login the web interface <${ASPERA_WEB}/?B=%2F${1}> with:
  33. username: ${ASPERA_USER}
  34. password: ${2}
  35. If you know how to use command 'ascp' in terminal, you can also do:
  36. ascp -P 33001 someLocalFile.bam ${ASPERA_USER}@${ASPERA_HOST}:/${1}/
  37. After upload, you will see the file in the 'Upload file' window in CistromeAP site.
  38. If you have any question, please send email to ${CISTROME_BUGS}. Please do not reply to this email.
  39. Best,
  40. Cistrome Dev Team
  41. --This email was sent by sendmail--
  42. EOF