Answer the question
In order to leave comments, you need to log in
How to make script autorun in ubuntu server?
Hello! Can't get the script to run automatically.
I tried to do it through forerver. I
installed it globally, then I wrote in the terminal
forever start script.js
The script started, but after restarting the server, it does not start automatically ((
Help, what am I doing wrong?(
Answer the question
In order to leave comments, you need to log in
In order for the script to run at boot, you need to write it in the /etc/rc.local file before the exit 0 line.
If you do not have this file, create it and paste the following content into it:
#
!/bin/sh -e
#Здесь вставляем строку с указанием вашего скрипта.
/usr/sbin/script.js
exit 0
It's best to write your own service (see /etc/init.d/skeleton sample) and set it to autostart (see man update-rc.d).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question