How to create a Profitrailer VPS startup script for Ubuntu

in ub •  7 years ago  (edited)

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.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @darmou! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @darmou! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

The Steem community has lost an epic member! Farewell @woflhart!
SteemitBoard - Witness Update
Do not miss the coming Rocky Mountain Steem Meetup and get a new community badge!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!