Pak Jiddat

Read: In the name of thy Lord Who createth, Createth man from a clot. Read: And thy Lord is the Most Bounteous, Who teacheth by the pen, Teacheth man that which he knew not. Nay, but verily man is rebellious That he thinketh himself independent!. Lo! unto thy Lord is the return. (Sura Alalaq 96:8)

Rocket Chat startup script

Created On: 12 Jan, 2017: 16:11:21 - Tags : software installation


The following script can be used to run an instance of Rocket Chat:


if [ $(ps -e -o uid,cmd | grep $USER | grep rocketchat | grep -v grep | wc -l | tr -s "\n") -eq 0 ]
        export PATH=/usr/local/bin:$PATH
        export MONGO_OPLOG_URL=mongodb://localhost:27017/local
        export ROOT_URL=http://your-domain/
        export MONGO_URL=mongodb://localhost:27017/your-database
        export PORT=1000
        export MAIL_URL=smtp://
        /root/.nvm/versions/node/v4.5.0/bin/forever start --minUptime 1000 --spinSleepTime 10000 --sourceDir path-to-rocket-chat main.js -l /var/log/forever.log -o /var/log/forever-out.log -e /var/log/forever-err.log

The above command checks if an instance of Rocket Chat is already running. If it is not running, then the Rocket Chat is run using the forever command. The forever command ensures that the Rocket Chat keeps running. It restarts the Rocket Chat automatically in case it stops. The forever script can be installed with the command: npm install forever. The above script may be run when the system boots up using the following cron job command: @reboot /root/scripts/ > /dev/null 2>&1

Related Articles

  1. Viewing package information using yum history command
  2. Installing latest version of Php
  3. Upgrading Postgresql from version 9.4 to 9.6
  4. Upgrading MySQL server from version 5.6 to 8.0
  5. Upgrading R from version 3.0 to 3.5
  6. Using PSCP command for copying files and directories
  7. Installing Docker on Debian Jessie
  8. Rocket Chat migration error
  9. Upgrading Rocket Chat to latest version
  10. Installing modules in Odoo 10.0
  11. Installing NodeJS on Ubuntu
  12. Installing W3C Markup Validator on Debian Jessie