Sometimes it’s useful to run ONOS as a service, specially in production environments. This is where things get more articulated and different, depending on the operating system you’re running.
Install the service files
Mandatory step for all OSs (only step needed for systemV - i.e. Ubuntu 12, old CentOS ver. < 7)
sudo cp /opt/onos/init/onos.initd /etc/init.d/onos
Ubuntu 12 and System V only: update rcX.d/ symlinks
If you are on Ubuntu 12 or an older System V system, you may need to create symbolic links to the onos startup script. On Ubuntu 12, this can be done using:
sudo update-rc.d onos defaults
Additional step for Upstart based systems (i.e. Ubuntu 14)
sudo cp /opt/onos/init/onos.conf /etc/init/onos.conf
Additional steps for Systemd based systems (i.e. Ubuntu 16, CentOS 7+)
sudo cp /opt/onos/init/onos.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable onos
Start, stop check the status of the ONOS service
Additional steps for Systemd based systems (i.e. Ubuntu 16, CentOS 7+)
sudo service onos {start|stop|status}