<commit_before># Ubuntu Upstart for managing your Rocket.Chat 
The following examples are upstart jobs which control automatic start-up and, if necessary, respawning of your Rocket.Chat app, as well as management of an optional hubot chat-bot.  
  
In order to use the examples, simply copy each example and save into a file, paying attention to the fact that the filenames should be preserved unless you edit the examples
to reflect any filename changes you make. Be sure to edit the environment variables, and possibly paths, according to your particular installation. Once you've saved the files to the
proper directory (/etc/init) usage is as simple as rebooting.
  
Which upstart management jobs that you use depend on what type of Rocket.Chat deployment you are using (Docker-compose, non-docker, etc). A race-condition exists with 
docker-compose which requires that mongo and the Rocket.Chat application be started independently, thus a slightly modified upstart job is required compared to non-docker instances. 
  
-------------------------  
  
### Non-Docker-Compose
Save as: `/etc/init/rocketchat.conf`  
```
description "rocketchat application server"

# Wait for mongod before starting rocketchat app  
start on (started mongod)  
stop on shutdown

# Automatically attempt to restart with finite limits
respawn
respawn limit 99 5

# Export necessary variables and start the Applications / Services
script
	export MONGO_URL=mongodb://localhost:27017/rocketchat 
	export ROOT_URL=https://host.yourdomain.tld 
	export PORT=3000
    exec /usr/local/bin/node /home/administrator/Rocket.Chat/main.js
end script
```
  
Save as: `/etc/init/rocketchat_hubot.conf`  
```
description "hubot launcher"

# Wait for the rocketchat upstart job before starting hubot
start on started rocketchat
stop on shutdown

# Automatically Respawn with finite limits
respawn
respawn limit 99 5
<commit_msg>change stop-on condition for consistency<commit_after># Ubuntu Upstart for managing your Rocket.Chat 
The following examples are upstart jobs which control automatic start-up and, if necessary, respawning of your Rocket.Chat app, as well as management of an optional hubot chat-bot.  
  
In order to use the examples, simply copy each example and save into a file, paying attention to the fact that the filenames should be preserved unless you edit the examples
to reflect any filename changes you make. Be sure to edit the environment variables, and possibly paths, according to your particular installation. Once you've saved the files to the
proper directory (/etc/init) usage is as simple as rebooting.
  
Which upstart management jobs that you use depend on what type of Rocket.Chat deployment you are using (Docker-compose, non-docker, etc). A race-condition exists with 
docker-compose which requires that mongo and the Rocket.Chat application be started independently, thus a slightly modified upstart job is required compared to non-docker instances. 
  
-------------------------  
  
### Non-Docker-Compose
Save as: `/etc/init/rocketchat.conf`  
```
description "rocketchat application server"

# Wait for mongod before starting rocketchat app  
start on (started mongod)  
stop on runlevel [!2345]

# Automatically attempt to restart with finite limits
respawn
respawn limit 99 5

# Export necessary variables and start the Applications / Services
script
	export MONGO_URL=mongodb://localhost:27017/rocketchat 
	export ROOT_URL=https://host.yourdomain.tld 
	export PORT=3000
    exec /usr/local/bin/node /home/administrator/Rocket.Chat/main.js
end script
```
  
Save as: `/etc/init/rocketchat_hubot.conf`  
```
description "hubot launcher"

# Wait for the rocketchat upstart job before starting hubot
start on started rocketchat
stop on runlevel [!2345]

# Automatically Respawn with finite limits
respawn
respawn limit 99 5

{'fraction_non_alphanumeric': 0.06760636909423128, 'fraction_numerical': 0.009919081179848603, 'mean_word_length': 4.206521739130435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3194960', 'n_tokens_mistral': 1071, 'n_tokens_neox': 998, 'n_words': 480}