22
0
Fork 0

Exemple pour systemd+forever+node.js

This commit is contained in:
jlecour 2017-07-25 23:48:37 +02:00
parent 784f560fbb
commit 0505a48f44
1 changed files with 23 additions and 0 deletions

View File

@ -462,4 +462,27 @@ systemd prend en compte les scripts dans `/etc/init.d/` :
* les scripts « classiques » sont pris en compte si il n'existe pas d'unité systemd avec le même nom (sa description commence alors par **LSB:**)
* certains scripts sont juste là par compatibilité afin de pouvoir faire `/etc/init.d/foo start/stop/restart/status` mais c'est en fait l'unité systemd qui est prise en compte
## Exemples d'unités
### Process Node.js géré via forever
*forever* est lui-même un gestionnaire de process, mais dans certains cas c'ets pertinent d'empiler les 2 gestionnaires. Voici un exemple fonctionnel (qu'on pourrait vouloir transformer en unité "user") :
~~~
# /etc/systemd/system/foo_chat.service
[Unit]
Description=Node.js process for Foo chat
After=network.target
[Service]
ExecStart=/usr/local/bin/forever start --pidFile /home/foo/www/foo.pid -o /home/foo/www/log/out.log -e /home/foo/www/log/err.log /home/foo/www/bin/www
ExecStop=/usr/local/bin/forever stop /home/foo/www/bin/www
PIDFile=/home/foo/www/foo.pid
Type=forking
LimitNOFILE=4096
User=nod
Restart=always
[Install]
WantedBy=default.target
~~~