« Linux : Création d'un service systemd » : différence entre les versions
De www.yakakliker.org
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| (Une version intermédiaire par le même utilisateur non affichée) | |||
| Ligne 31 : | Ligne 31 : | ||
[Install] | [Install] | ||
WantedBy=default.target | WantedBy=default.target | ||
</syntaxhighlight> | |||
=== Activer des logs === | |||
<syntaxhighlight lang="bash"> | |||
StandardOutput=append:/home/appli/www/logs/std.log | |||
StandardError=append:/home/appli/www/logs/error.log | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Ligne 51 : | Ligne 58 : | ||
</html> | </html> | ||
[[Catégorie:Linux]] | [[Catégorie:Linux]] | ||
[[Catégorie:Systemd]] | |||
Dernière version du 18 février 2026 à 11:20
sudo /etc/systemd/system/application.service
Exemples
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
[Unit]
Description=Gunicorn instance to serve application
After=network.target
[Service]
User=application
Group=application
WorkingDirectory=/home/application/www/flask
Environment="PATH=/home/application/www/flask"
ExecStart=/home/application/.pyenv/versions/3.9.20/bin/gunicorn -w 4 -c gunicorn_conf.py 'application:app' --bind 127.0.0.1:8000
[Install]
WantedBy=default.target
Activer des logs
StandardOutput=append:/home/appli/www/logs/std.log
StandardError=append:/home/appli/www/logs/error.log