Built motion from commit b6cf875.|1.0.15
[motion.git] / scripts / post-merge.sh
index 6e1a6f9..fcc54de 100644 (file)
@@ -2,16 +2,48 @@
 
 echo "post-merge started"
 cd /var/opt/motion
+
 echo "npm install --production"
 env CC=/opt/rh/devtoolset-3/root/usr/bin/gcc CXX=/opt/rh/devtoolset-3/root/usr/bin/g++ npm install --production
+
 echo "sequelize"
 sequelize db:migrate --migrations-path server/migrations --config server/config/environment/dbconf.json --env production
+
 echo "sequelize-history"
-sequelize db:migrate --migrations-path server/migrations-history --config server/config/environment/dbconfhistory.json --env production
+sequelize db:migrate --migrations-path server/migrations-history --config server/config/environment/dbconf.json --env production
+
 echo "tigerdial-update"
 tigerdial-update
-echo "tigerdial restart"
-service tigerd restart
-echo "pm2 restart"
-pm2 restart motion
+
+echo "install motion_safe"
+curl --silent --location https://provisioning.xcally.com/files/packages/motion/motion_safe/install_safe | bash
+
+echo "add rtp_xcally configuration file"
+RTP_FILE=/etc/asterisk/rtp.conf
+RTP_XCALLY_FILE=/etc/asterisk/rtp_xcally.conf
+touch $RTP_XCALLY_FILE
+chmod 666 $RTP_XCALLY_FILE
+if ! grep -q rtp_xcally $RTP_FILE; then
+  echo 'Include extensions file...'
+  echo '#include "rtp_xcally.conf"' >> $RTP_FILE
+fi
+
+#echo "uninstall pm2-logrotate"
+#pm2 uninstall pm2-logrotate
+
+echo "configure logrotate"
+MOTION_LOGROTATE=/etc/logrotate.d/motion
+#echo "/var/log/xcally/motion-out.log" > $MOTION_LOGROTATE
+#echo "/var/log/xcally/motion-err.log" >> $MOTION_LOGROTATE
+echo "/var/log/xcally/access.log {" > $MOTION_LOGROTATE
+echo "  daily" >> $MOTION_LOGROTATE
+echo "  rotate 7" >> $MOTION_LOGROTATE
+echo "  compress" >> $MOTION_LOGROTATE
+echo "  delaycompress" >> $MOTION_LOGROTATE
+echo "  notifempty" >> $MOTION_LOGROTATE
+echo "  postrotate" >> $MOTION_LOGROTATE
+echo "    /usr/bin/pm2 gracefulReload motion" >> $MOTION_LOGROTATE
+echo "  endscript" >> $MOTION_LOGROTATE
+echo "}" >> $MOTION_LOGROTATE
+
 echo "post-merge finished"