setup_evironment.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. IFACE="eth10"
  2. echo "deactivating previous environment"
  3. deactivate
  4. #rm /var/lib/mongodb/mongod.lock
  5. #mongod --repair
  6. #ervice mongodb start
  7. if [ "$1" == "startinterface" ]; then
  8. echo "configuring interface"
  9. modprobe dummy 1>&/dev/null
  10. ip link set name $IFACE dev dummy0 1>&/dev/null
  11. ip link show $IFACE
  12. ifconfig $IFACE txqueuelen 10000
  13. ifconfig $IFACE 1.1.1.1
  14. ifconfig $IFACE hw ether be:af:8b:42:ca:d3
  15. ifconfig $IFACE up
  16. if [ -n "$(grep "Ubuntu" <<< $(uname -a))" ]; then
  17. echo "restarting mongodb for Ubuntu"
  18. service mongodb stop
  19. rm /var/lib/mongodb/tracing.*
  20. rm /var/lib/mongodb/local.*
  21. rm /var/lib/mongodb/mongod.lock
  22. rm -rf /var/lib/mongodb/tracing
  23. #mongod --repair --dbpath /var/lib/mongodb/
  24. service mongodb start
  25. else
  26. echo "restarting mongodb for non-Ubuntu"
  27. # clear mongo db databases, see /etc/mongodb.conf
  28. # alternativelly call: mongod --repair --dbpath /var/lib/mongodb/
  29. /etc/init.d/mongodb stop 1>&/dev/null
  30. rm /var/lib/mongodb/tracing.*
  31. rm /var/lib/mongodb/local.*
  32. rm /var/lib/mongodb/mongod.lock
  33. #mongod --repair --dbpath /var/lib/mongodb/
  34. /etc/init.d/mongodb start
  35. /etc/init.d/mongodb status
  36. fi
  37. fi
  38. # Prepare isolated environment
  39. #virtualenv -p /usr/bin/python2.6 <path/to/new/virtualenv/>
  40. #virtualenv $VIRTUAL_ENV
  41. echo "setting up virtual env for python"
  42. # Info: call via: srouce [script]
  43. # Setup virtual environment
  44. echo "setting VIRTUAL_ENV=$HOME/.virtualenv"
  45. VIRTUAL_ENV=$HOME/.virtualenv
  46. # Activate isolated environment
  47. echo "activating isolated environment"
  48. source $VIRTUAL_ENV/bin/activate