This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
управление_сервисами_в_linux [2022/03/11 09:42] val [Настройка параметров запуска в Systemd] |
управление_сервисами_в_linux [2025/04/10 07:07] (current) val [Управление юнитами Systemd] |
||
---|---|---|---|
Line 36: | Line 36: | ||
#!/bin/sh | #!/bin/sh | ||
- | /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 & |
exit 0 | exit 0 | ||
Line 84: | 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 132: | Line 132: | ||
# chkconfig --list sshvpn | # chkconfig --list sshvpn | ||
- | # chkconfig --del sshvpn | + | # chkconfig sshvpn on |
+ | |||
+ | # #chkconfig sshvpn off | ||
+ | |||
+ | # #chkconfig --del sshvpn | ||
</code> | </code> | ||
==== Управление ресурсами ==== | ==== Управление ресурсами ==== | ||
Line 150: | Line 154: | ||
==== Управление юнитами Systemd ===== | ==== Управление юнитами Systemd ===== | ||
+ | |||
+ | * [[https://docs.gitea.io/en-us/linux-service/|Run Gitea as Linux service]] | ||
+ | * Сервис SNORT [[Сервис SNORT#Копирование alert_unified2 в syslog]] | ||
<code> | <code> | ||
$ systemctl -a | $ systemctl -a | ||
$ systemctl list-units | $ systemctl list-units | ||
+ | $ systemctl --failed | ||
centos# find /usr/lib/systemd/system/ | centos# find /usr/lib/systemd/system/ | ||
Line 176: | Line 184: | ||
[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=5 -o ServerAliveCountMax=1 -o ExitOnForwardFailure=yes userX@gate.isp.un |
+ | #ExecStart=/usr/bin/java -jar /home/jenkins/agent.jar -url http://server.corp13.un:8081/ -secret NNNNNNNNNNNNNNNNNNNN -name gate -workDir "/home/jenkins/" | ||
+ | #User=jenkins | ||
KillMode=process | KillMode=process | ||
- | Restart=on-failure | + | Restart=always |
RestartSec=42s | RestartSec=42s | ||
Line 186: | Line 196: | ||
# systemctl status sshvpn | # systemctl status sshvpn | ||
- | # systemctl enable sshvpn | + | # systemctl enable sshvpn --now |
- | # systemctl start sshvpn | + | # ###systemctl start sshvpn |
</code> | </code> | ||
Line 197: | Line 207: | ||
</code><code> | </code><code> | ||
[Service] | [Service] | ||
- | LimitNOFILE=65536 # nginx | + | LimitNOFILE=65536 # nginx, squid |
- | LimitNOFILESoft=65536 # nginx | + | |
TimeoutStartSec=180 # elasticsearch | TimeoutStartSec=180 # elasticsearch | ||
</code><code> | </code><code> |