##Pi-Signage node as a system service ###Installing a node instance as a system service in CentOS 7
You need a user with sudo privileges, but limited to running node. This example will use the user mediaservice
$ visudo
Change the line Defaults: requiretty
To
Defaults:mediaservice !requiretty
At the end of the sudoers file, add the next line
mediaservice ALL = NOPASSWD: /usr/bin/node
This will ensure mediaservice
can only run as root the node process.
##Install the Pi-Signage System Service
Note: always inspect what you download, be sure to read the downloaded script using less /etc/init.d/pi-signage
$ cd /etc/init.d
$ sudo wget https://gist.githubusercontent.com/hdml/e7f1c17e52b3dc4b8993/raw/1b4365a72a077e8541c13b256d97c973cdfd3e94/pi-signage
$ sudo chmod +x pi-signage
Register the new service
$ sudo chkconfig --add pi-signage
$ systemctl daemon-reload
Check that the service registered successfully
$ chkconfig --list
##Start the service
$ sudo service pi-signage start
Note: if the service fails to start, check systemctl status pi-signage.service
. If there's an error that says the server is locked, remove the file in /var/lock/subsys/node-server
.