Guest User

Untitled

a guest
Feb 8th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #
  4. # Download latest ant media server and run this script by giving the zip file
  5. # ./install_ant-media-server.sh ant-media-server-*.zip
  6. #
  7.  
  8. if [ -z "$1" ]; then
  9. echo "Please give the Ant Media Server zip file as parameter"
  10. echo "$0 ant-media-server-....zip"
  11. exit 1
  12. fi
  13.  
  14. SUDO="sudo"
  15. if ! [ -x "$(command -v sudo)" ]; then
  16. SUDO=""
  17. fi
  18.  
  19. $SUDO apt-get update -y
  20. OUT=$?
  21. if [ $OUT -ne 0 ]; then
  22. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  23. exit $OUT
  24. fi
  25.  
  26. $SUDO apt-get install openjdk-8-jdk -y
  27. OUT=$?
  28. if [ $OUT -ne 0 ]; then
  29. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  30. exit $OUT
  31. fi
  32.  
  33. $SUDO apt-get install unzip -y
  34. OUT=$?
  35. if [ $OUT -ne 0 ]; then
  36. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  37. exit $OUT
  38. fi
  39.  
  40. unzip $1
  41. OUT=$?
  42. if [ $OUT -ne 0 ]; then
  43. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  44. exit $OUT
  45. fi
  46.  
  47. $SUDO mv ant-media-server /usr/local/antmedia
  48. OUT=$?
  49. if [ $OUT -ne 0 ]; then
  50. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  51. exit $OUT
  52. fi
  53.  
  54. $SUDO apt-get install jsvc -y
  55. OUT=$?
  56. if [ $OUT -ne 0 ]; then
  57. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  58. exit $OUT
  59. fi
  60.  
  61. $SUDO sed -i '/JAVA_HOME="\/usr\/lib\/jvm\/java-8-oracle"/c\JAVA_HOME="\/usr\/lib\/jvm\/java-8-openjdk-amd64"' /usr/local/antmedia/antmedia
  62. OUT=$?
  63. if [ $OUT -ne 0 ]; then
  64. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  65. exit $OUT
  66. fi
  67.  
  68. $SUDO cp /usr/local/antmedia/antmedia /etc/init.d/
  69. OUT=$?
  70. if [ $OUT -ne 0 ]; then
  71. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  72. exit $OUT
  73. fi
  74.  
  75. $SUDO update-rc.d antmedia defaults
  76. OUT=$?
  77. if [ $OUT -ne 0 ]; then
  78. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  79. exit $OUT
  80. fi
  81.  
  82. $SUDO update-rc.d antmedia enable
  83. OUT=$?
  84. if [ $OUT -ne 0 ]; then
  85. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  86. exit $OUT
  87. fi
  88.  
  89. $SUDO mkdir /usr/local/antmedia/log
  90. OUT=$?
  91. if [ $OUT -ne 0 ]; then
  92. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  93. exit $OUT
  94. fi
  95.  
  96. $SUDO useradd -d /usr/local/antmedia/ -s /bin/false -r antmedia
  97. OUT=$?
  98. if [ $OUT -ne 0 ]; then
  99. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  100. exit $OUT
  101. fi
  102.  
  103. $SUDO chown -R antmedia:antmedia /usr/local/antmedia/
  104. OUT=$?
  105. if [ $OUT -ne 0 ]; then
  106. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  107. exit $OUT
  108. fi
  109.  
  110. $SUDO service antmedia start
  111. OUT=$?
  112.  
  113. if [ $OUT -eq 0 ]; then
  114. echo "Ant Media Server is started"
  115. else
  116. echo "There is a problem in installing the ant media server. Please send the log of this console to contact@antmedia.io"
  117. fi
Add Comment
Please, Sign In to add comment