Daryl avatar

How to create a Profitrailer VPS startup script for Ubuntu

darmou

Published: 20 Feb 2018 › Updated: 20 Feb 2018How to create a Profitrailer VPS startup script for Ubuntu

How to create a Profitrailer VPS startup script for Ubuntu

There are several ways of adding a script on startup, however one of the easiest is to alter the /etc/rc.local script in Ubuntu.

We can provide a startup script in /usr/local/bin called profittrailer_start.sh

#!/bin/sh
# 0 is the id for profit trailer for me pm2 status will show which id you have
/usr/local/bin/pm2 restart 0 
# 1 is the id for profit trailer feeder
/usr/local/bin/pm2 restart 1
sudo chmod +x /usr/local/bin/profittrailer_start.sh
sudo chmod 755 /usr/local/bin/profittrailer_start.sh

Next, update your /etc/rc.local script with full path and name of your created script after the sh command

#!/bin/sh -e
#Ensure the above line is at the top
sh '/usr/local/bin/profittrailer_start.sh'

# Remember to put the line below at the end
exit 0

Then make rc.local executable

sudo chown root /etc/rc.local
sudo chmod 755 /etc/rc.local

Check everything works fine by executing

sudo /etc/init.d/rc.local start

Test restart your system.

Leave How to create a Profitrailer VPS startup script for Ubuntu to:

Written by

Software Engineer

Read more #ubuntu posts


Best Posts From Daryl

We have not curated any of darmou's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Daryl