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
Next revision Both sides next revision
управление_сервисами_в_linux [2017/12/05 07:40]
val [Система загрузки OpenRC]
управление_сервисами_в_linux [2022/03/11 09:42]
val [Настройка параметров запуска в Systemd]
Line 24: Line 24:
  
   * [[Сигналы]]   * [[Сигналы]]
 +
 +===== Определение системы загрузки =====
 +<​code>​
 +$ ps -p 1
 +</​code>​
  
 ===== Система загрузки rc.local ===== ===== Система загрузки rc.local =====
Line 29: Line 34:
 # cat /​etc/​rc.local # cat /​etc/​rc.local
 </​code><​code>​ </​code><​code>​
-...+#!/bin/sh 
 /​usr/​bin/​ssh -N -R 200X:​localhost:​22 userX@gate.isp.un & /​usr/​bin/​ssh -N -R 200X:​localhost:​22 userX@gate.isp.un &
  
 exit 0 exit 0
 +</​code><​code>​
 +chmod +x /​etc/​rc.local
 </​code>​ </​code>​
 +
  
 ===== Система загрузки SysV ===== ===== Система загрузки SysV =====
Line 119: Line 128:
 # chkconfig --list # chkconfig --list
  
-# chkconfig --del sshd+# chkconfig --add sshvpn
  
-# chkconfig --list ​sshd+# chkconfig --list ​sshvpn
  
-# chkconfig --add sshd +# chkconfig --del sshvpn 
- +</​code>​ 
- +==== Управление ресурсами ==== 
-# chkconfig sshd on +<​code>​ 
- +cat /​etc/​init.d/​asterisk 
-chkconfig sshd off +</​code><​code>​ 
- +... 
- +MAXFILES=65536 
-# chkconfig --level 2 sshd on +...
- +
-# chkconfig --level 35 sshd on+
 </​code>​ </​code>​
- 
 ===== Система загрузки Systemd ===== ===== Система загрузки Systemd =====
  
Line 142: 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 =====
  
 <​code>​ <​code>​
 $ systemctl -a $ systemctl -a
-$ systemctl list-unit-files+$ systemctl list-units
  
 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 181: Line 191:
 </​code>​ </​code>​
  
 +==== Настройка параметров запуска в Systemd =====
 +
 +<​code>​
 +# systemctl edit имясервиса
 +</​code><​code>​
 +[Service]
 +LimitNOFILE=65536 ​     # nginx 
 +LimitNOFILESoft=65536 ​ # nginx
 +TimeoutStartSec=180 ​   # elasticsearch
 +</​code><​code>​
 +# systemctl daemon-reload ​    # не очевидно,​ что нужно
 +
 +# systemctl show имясервиса
 +
 +# systemctl restart имясервиса
 +
 +# systemctl status имясервиса
 +
 +# cat /​proc/​NNNNN/​limits
 +</​code>​
 ===== Система загрузки OpenRC ===== ===== Система загрузки OpenRC =====
  
 <​code>​ <​code>​
-# rc-service sshd start +# ls /​etc/​init.d/​ 
-# rc-service ​sshd stop+# /​etc/​init.d/​sshd status|start|stop 
 + 
 +# rc-service sshd status|start|stop 
 + 
 +# rc-update add|del ​sshd default 
 + 
 +# rc-update show
  
-# rc-update add sshd default 
 # openrc # openrc
 </​code>​ </​code>​
управление_сервисами_в_linux.txt · Last modified: 2023/06/01 13:55 by val