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.
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
Congratulations @darmou! You received a personal award!
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:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!