Outils pour utilisateurs

Outils du site


tech:systemd_service_-_exemples

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:systemd_service_-_exemples [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:systemd_service_-_exemples [2025/11/13 20:35] (Version actuelle) Jean-Baptiste
Ligne 36: Ligne 36:
 === Exemple conf proxy === Exemple conf proxy
  
-<code ini /etc/systemd/system/docker.service.d/http-proxy.conf>+ 
 +''/etc/systemd/system/docker.service.d/http-proxy.conf'' 
 +<code ini>
 [Service] [Service]
-Environment="HTTP_PROXY=http://192.168.56.1:3128/" "HTTPS_PROXY=http://192.168.56.1:3128/" "NO_PROXY=localhost,127.0.0.0/8,192.168.0.0/16,docker-1"+Environment="HTTP_PROXY=http://192.168.56.1:3128/" "HTTPS_PROXY=http://192.168.56.1:3128/" "NO_PROXY=localhost,127.0.0.0/8,192.168.0.0/16,docker-1" 
 +Environment="ALL_PROXY=http://192.168.56.1:3128/" "NO_PROXY=localhost,127.0.0.0/8,192.168.0.0/16,docker-1" 
 </code> </code>
  
Ligne 50: Ligne 54:
 === Désactiver un service si un fichier est présent === Désactiver un service si un fichier est présent
  
-<code ini /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf>+''/lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf'' 
 +<code ini>
 [Unit] [Unit]
 # don't run timesyncd if we have another NTP daemon installed # don't run timesyncd if we have another NTP daemon installed
 #ConditionFileIsExecutable=!/usr/sbin/VBoxService #ConditionFileIsExecutable=!/usr/sbin/VBoxService
 </code> </code>
 +
  
 === Arguments utiles === Arguments utiles
Ligne 82: Ligne 88:
 systemd-run --on-active=30 --timer-property=AccuracySec=100ms /bin/touch /tmp/foo systemd-run --on-active=30 --timer-property=AccuracySec=100ms /bin/touch /tmp/foo
 </code> </code>
 +
  
 == Exemple == Exemple
Ligne 98: Ligne 105:
 </code> </code>
  
-<code ini /lib/systemd/system/confluence.service>+ 
 +''/lib/systemd/system/confluence.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=Confluence Description=Confluence
Ligne 129: Ligne 138:
 systemctl status confluence.service systemctl status confluence.service
 </code> </code>
 +
  
 === Exemple 2 === Exemple 2
Ligne 134: Ligne 144:
 https://wiki.archlinux.org/index.php/Advanced_Format https://wiki.archlinux.org/index.php/Advanced_Format
  
-<code ini /etc/systemd/system/lcc_fix.service>+''/etc/systemd/system/lcc_fix.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=WDIDLE3 Description=WDIDLE3
Ligne 149: Ligne 160:
 WantedBy=multi-user.target WantedBy=multi-user.target
 </code> </code>
 +
  
 === Exemple 3 === Exemple 3
Ligne 154: Ligne 166:
 Source : https://fabianlee.org/2017/05/21/golang-running-a-go-binary-as-a-systemd-service-on-ubuntu-16-04/ Source : https://fabianlee.org/2017/05/21/golang-running-a-go-binary-as-a-systemd-service-on-ubuntu-16-04/
  
-<code ini /lib/systemd/system/sleepservice.service>+''/lib/systemd/system/sleepservice.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=Sleep service Description=Sleep service
Ligne 189: Ligne 202:
  
 Exemple avec SonarQube Exemple avec SonarQube
-<code ini /etc/systemd/system/sonar.service>+ 
 +''/etc/systemd/system/sonar.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=Sonar 6 Description=Sonar 6
Ligne 206: Ligne 221:
 WantedBy=multi-user.target WantedBy=multi-user.target
 </code> </code>
 +
  
 === Exemple Jenkins slave agent === Exemple Jenkins slave agent
  
-<code ini Jenkins-agent.service>+ 
 +''Jenkins-agent.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=Jenkins Service Description=Jenkins Service
Ligne 223: Ligne 241:
 WantedBy=multi-user.target WantedBy=multi-user.target
 </code> </code>
 +
  
 === Exemple Postgres === Exemple Postgres
  
-<code ini /usr/local/lib/systemd/system/postgres_plop_rct.service>+''/usr/local/lib/systemd/system/postgres_plop_rct.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=postgresql_plop_rct_service Description=postgresql_plop_rct_service
Ligne 257: Ligne 277:
 === Exemple AAP - Tirer des dépendances seulement === Exemple AAP - Tirer des dépendances seulement
  
-<code ini /etc/systemd/system/automation-controller.service>+ 
 +''/etc/systemd/system/automation-controller.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=Automation Controller service Description=Automation Controller service
Ligne 275: Ligne 297:
 === Exemple iptables-service de RedHat === Exemple iptables-service de RedHat
  
-<code ini /usr/lib/systemd/system/iptables.service>+''/usr/lib/systemd/system/iptables.service'' 
 +<code ini>
 [Unit] [Unit]
 Description=IPv4 firewall with iptables Description=IPv4 firewall with iptables
Ligne 296: Ligne 319:
 </code> </code>
  
-<code bash /usr/libexec/iptables/iptables.init>+ 
 +''/usr/libexec/iptables/iptables.init'' 
 +<code bash>
 #!/bin/bash #!/bin/bash
 # #
Ligne 369: Ligne 394:
  
  
 +=== Exemple Nagios
 +
 +''nagios4.service''
 +<code ini>
 +[Unit]
 +Description=nagios4
 +Documentation=man:nagios4
 +
 +[Service]
 +Environment=NAGIOSCFG="/etc/nagios4/nagios.cfg"
 +EnvironmentFile=/etc/default/nagios4
 +ExecStartPre=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"'
 +ExecStart=/usr/sbin/nagios4 ${NAGIOSCFG}
 +ExecStopPost=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"'
 +ExecReload=/bin/kill -HUP $MAINPID
 +KillMode=mixed
 +PIDFile=/run/nagios4/nagios.pid
 +
 +[Install]
 +WantedBy=multi-user.target
 +</code>
  
  
tech/systemd_service_-_exemples.1742825205.txt.gz · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki