startDev.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # check if systemctl exists
  3. echo 'check, if mongodb is running'
  4. if([ -f /usr/bin/systemctl ]); then
  5. # check if mongodb is running
  6. if([ `systemctl status mongodb | grep Active | grep dead | wc -l` == 1 ]); then
  7. echo 'is not running, starting'
  8. sudo systemctl start mongodb
  9. else
  10. echo 'mongodb is running'
  11. fi
  12. else
  13. echo 'sorry, no systemctl found, trying to run although'
  14. fi
  15. # let grunt run in another window
  16. gruntCommand="grunt watch; sleep 5;"
  17. if([ `ps aux | grep "$gruntCommand" | wc -l` -eq 1 ]); then
  18. echo 'starting grunt in another xterm window'
  19. xterm -e "$gruntCommand" &
  20. else
  21. echo "grunt is running, though not starting"
  22. fi
  23. # let django run
  24. djangoCommand="python3 manage.py runserver"
  25. if([ `ps aux | grep "$djangoCommand" | wc -l` -eq 1 ]); then
  26. remoteVar=""
  27. if([ "$1" = "remote" ]); then
  28. remoteVar=" 0.0.0.0:8000"
  29. fi
  30. echo "starting django server in another xterm window"
  31. xterm -e "python2 manage.py runserver $remoteVar" &
  32. else
  33. echo "django is running, though not starting"
  34. fi