User Tools

Site Tools


управление_сервисами_в_linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
управление_сервисами_в_linux [2020/06/23 08:34]
val [Система загрузки OpenRC]
управление_сервисами_в_linux [2023/06/01 13:55]
val [Скрипты запуска/остановки]
Line 24: Line 24:
  
   * [[Сигналы]]   * [[Сигналы]]
 +
 +===== Определение системы загрузки =====
 +<​code>​
 +$ ps -p 1
 +</​code>​
  
 ===== Система загрузки rc.local ===== ===== Система загрузки rc.local =====
Line 37: Line 42:
 chmod +x /​etc/​rc.local chmod +x /​etc/​rc.local
 </​code>​ </​code>​
 +
 +
 ===== Система загрузки SysV ===== ===== Система загрузки SysV =====
  
Line 77: Line 84:
 then then
         echo Starting sshvpn...         echo Starting sshvpn...
-        /​usr/​bin/​ssh -N -R 200X:​localhost:​22 userX@gate.isp.un &+        /​usr/​bin/​ssh -N -R 61000+X:​localhost:​22 ​-o ServerAliveInterval=60 -o ExitOnForwardFailure=yes ​userX@gate.isp.un &
         echo $! > /​var/​run/​sshvpn.pid         echo $! > /​var/​run/​sshvpn.pid
 elif [ "​$1"​ = stop ] elif [ "​$1"​ = stop ]
Line 127: Line 134:
 # chkconfig --del sshvpn # chkconfig --del sshvpn
 </​code>​ </​code>​
 +==== Управление ресурсами ==== 
 +<​code>​ 
 +# cat /​etc/​init.d/​asterisk 
 +</​code><​code>​ 
 +... 
 +MAXFILES=65536 
 +... 
 +</​code>​
 ===== Система загрузки Systemd ===== ===== Система загрузки Systemd =====
  
Line 134: Line 148:
   * [[https://​habrahabr.ru/​company/​centosadmin/​blog/​255845/​|Systemd за пять минут]]   * [[https://​habrahabr.ru/​company/​centosadmin/​blog/​255845/​|Systemd за пять минут]]
   * [[https://​wiki.archlinux.org/​index.php/​systemd|systemd]]   * [[https://​wiki.archlinux.org/​index.php/​systemd|systemd]]
 +
 +==== Управление юнитами Systemd =====
 +
 +  * [[https://​docs.gitea.io/​en-us/​linux-service/​|Run Gitea as Linux service]]
  
 <​code>​ <​code>​
Line 141: Line 159:
 centos# find /​usr/​lib/​systemd/​system/​ centos# find /​usr/​lib/​systemd/​system/​
 debian# find /​lib/​systemd/​system/​ debian# find /​lib/​systemd/​system/​
 +
 +# find /​etc/​default/​
  
 $ systemctl status ssh $ systemctl status ssh
Line 158: Line 178:
  
 [Service] [Service]
-ExecStart=/​usr/​bin/​ssh -N -R 200X:​localhost:​22 userX@gate.isp.un+ExecStart=/​usr/​bin/​ssh -N -R 61000+X:​localhost:​22 ​-o ServerAliveInterval=60 -o ExitOnForwardFailure=yes ​userX@gate.isp.un
 KillMode=process KillMode=process
-Restart=on-failure+Restart=always
 RestartSec=42s RestartSec=42s
  
Line 173: Line 193:
 </​code>​ </​code>​
  
 +==== Настройка параметров запуска в Systemd =====
 +
 +<​code>​
 +# systemctl edit имясервиса
 +</​code><​code>​
 +[Service]
 +LimitNOFILE=65536 ​     # nginx 
 +TimeoutStartSec=180 ​   # elasticsearch
 +</​code><​code>​
 +# systemctl daemon-reload ​    # не очевидно,​ что нужно
 +
 +# systemctl show имясервиса
 +
 +# systemctl restart имясервиса
 +
 +# systemctl status имясервиса
 +
 +# cat /​proc/​NNNNN/​limits
 +</​code>​
 ===== Система загрузки OpenRC ===== ===== Система загрузки OpenRC =====
  
управление_сервисами_в_linux.txt · Last modified: 2023/06/01 13:55 by val