1158ccacbe19d45de37516ce01c8ea7794ae6a7b
[motion.git] / scripts / post-merge.sh
1 #!/bin/bash
2
3 echo "post-merge started"
4 cd /var/opt/motion
5
6 echo "npm install --production"
7 env CC=/opt/rh/devtoolset-3/root/usr/bin/gcc CXX=/opt/rh/devtoolset-3/root/usr/bin/g++ npm install --production
8
9 echo "sequelize"
10 sequelize db:migrate --migrations-path server/migrations --config server/config/environment/dbconf.json --env production
11
12 echo "sequelize-history"
13 sequelize db:migrate --migrations-path server/migrations-history --config server/config/environment/dbconf.json --env production
14
15 echo "tigerdial-update"
16 tigerdial-update
17
18 echo "install motion_safe"
19 curl --silent --location https://provisioning.xcally.com/files/packages/motion/motion_safe/install_safe | bash
20
21 echo "add rtp_xcally configuration file"
22 RTP_FILE=/etc/asterisk/rtp.conf
23 RTP_XCALLY_FILE=/etc/asterisk/rtp_xcally.conf
24 touch $RTP_XCALLY_FILE
25 chmod 666 $RTP_XCALLY_FILE
26 if ! grep -q rtp_xcally $RTP_FILE; then
27   echo 'Include extensions file...'
28   echo '#include "rtp_xcally.conf"' >> $RTP_FILE
29 fi
30
31 echo "uninstall pm2-logrotate"
32 pm2 uninstall pm2-logrotate
33
34 echo "configure logrotate"
35 MOTION_LOGROTATE=/etc/logrotate.d/motion
36 echo "/var/log/xcally/motion-out.log" > $MOTION_LOGROTATE
37 echo "/var/log/xcally/motion-err.log" >> $MOTION_LOGROTATE
38 echo "/var/log/xcally/access.log {" >> $MOTION_LOGROTATE
39 echo "  daily" >> $MOTION_LOGROTATE
40 echo "  rotate 7" >> $MOTION_LOGROTATE
41 echo "  compress" >> $MOTION_LOGROTATE
42 echo "  delaycompress" >> $MOTION_LOGROTATE
43 echo "  notifempty" >> $MOTION_LOGROTATE
44 echo "  postrotate" >> $MOTION_LOGROTATE
45 echo "    /usr/bin/pm2 gracefulReload motion" >> $MOTION_LOGROTATE
46 echo "  endscript" >> $MOTION_LOGROTATE
47 echo "}" >> $MOTION_LOGROTATE
48
49 echo "post-merge finished"