Действия

Linux: различия между версиями

Материал из lulzette's wiki

(Новая страница: «# server stuff == iptables == <code>sudo iptables -t nat -A PREROUTING --dst 192.168.100.101 -p tcp --dport 1900 -j DNAT --to-destination 10.0.0.2:1880</code> s…»)
 
Нет описания правки
 
(не показаны 23 промежуточные версии этого же участника)
Строка 1: Строка 1:
# server stuff
[[Category:Админство (Ops)]]


== iptables ==
== fstab ==


<code>sudo iptables -t nat -A PREROUTING --dst 192.168.100.101 -p tcp --dport 1900 -j DNAT --to-destination 10.0.0.2:1880</code>
=== не фейлиться если проблемы ===
server:1900 -> vm:1880


=== mail ===
<code>/dev/disk/by-uuid/1bd74118-86ae-4701-b3b0-dfbf0574274e /disks ext4 defaults,noatime,nofail 0 0</code>
MTA - передача писем, только SMTP
MDA - получение писем, MDA общается с MTA для их получения


MTA - exim, postfix, sendmail
== открытые процессом файлы ==
MDA - dovecot, cyrus
 
<code>/proc/PIDOF/fd/</code>
 
== сигналы (процессы) ==
 
Ctrl+C - SIGINT
 
SIGTERM ожидает завершения процесса, SIGKILL завершает процесс принудительно, не дожидаясь корректного завершения программы.
 
https://www.geeksforgeeks.org/segmentation-fault-sigsegv-vs-bus-error-sigbus/
 
SIGSEGV - Нарушение прав доступа к памяти, например, приложение попыталось записать в Read-only память.
 
SIGBUS - обращение процесса к некорректному адресу памяти.
 
<code>The main difference between Segmentation Fault and Bus Error is that Segmentation Fault indicates an invalid access to a valid memory, while Bus Error indicates an access to an invalid address.</code>
 
SIGCHLD - сигнал отправляет родительский процесс дитенышу, чтобы тот завершил свою деятельность [https://www.quora.com/What-is-SIGCHLD-in-Linux?share=1]
 
== Состояние процессов ==
 
Рекомендую: <code>man ps</code>, раздел "PROCESS STATE CODES"
 
Больше инфы: http://rus-linux.net/MyLDP/proc/processes-in-Linux.html <br>
Меньше инфы: https://www.k-max.name/linux/processy-v-linux/
 
Интерактивный режим - процесс переднего плана, имеет состояние со знаком плюс (например R+, S+). Такие процессы ждут ввода от пользователя, такое бывает, например, когда процесс запущен на переднем плане в консоли.
 
* Sleep
 
<code>knflkr    297090  0.0  0.0  5328  648 pts/3    S+  21:04  0:00 sleep 10000</code>
 
* Sleep, Ctrl+z, <code>bg</code>
 
<code>knflkr    297090  0.0  0.0  5328  648 pts/3    S    21:04  0:00 sleep 10000</code>
 
<source>
PROCESS STATE CODES
      Here are the different values that the s, stat and state output specifiers (header "STAT" or "S")
      will display to describe the state of a process:
 
              D    uninterruptible sleep (usually IO)
              I    Idle kernel thread
              R    running or runnable (on run queue)
              S    interruptible sleep (waiting for an event to complete)
              T    stopped by job control signal
              t    stopped by debugger during the tracing
              W    paging (not valid since the 2.6.xx kernel)
              X    dead (should never be seen)
              Z    defunct ("zombie") process, terminated but not reaped by its parent
 
      For BSD formats and when the stat keyword is used, additional characters may be displayed:
 
              <    high-priority (not nice to other users)
              N    low-priority (nice to other users)
              L    has pages locked into memory (for real-time and custom IO)
              s    is a session leader
              l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
              +    is in the foreground process group
</source>


== nextcloud preview configuration ==
== nextcloud preview configuration ==
  I don't want to generate all the preview sizes
  I don't want to generate all the preview sizes

This is possible since version 1.0.8. Just set the correct values via the command line

This is possible since version 1.0.8. Just set the correct values via the command line

```
<source>
./occ config:app:set --value="32 64 1024" previewgenerator squareSizes
./occ config:app:set --value="32 64 1024" previewgenerator squareSizes
./occ config:app:set --value="64 128 1024" previewgenerator widthSizes
./occ config:app:set --value="64 128 1024" previewgenerator widthSizes
./occ config:app:set --value="64 256 1024" previewgenerator heightSizes
./occ config:app:set --value="64 256 1024" previewgenerator heightSizes
```
</source>

This will only generate:

This will only generate:
* square previews ofL 32x32, 64x64 and 1024x1024* aspect ratio previews with a width of: 64, 128 and 1024
* square previews ofL 32x32, 64x64 and 1024x1024* aspect ratio previews with a width of: 64, 128 and 1024
Строка 28: Строка 84:
* The smallest size is 32
* The smallest size is 32
* The max size is determined by your preview settings in config.php
* The max size is determined by your preview settings in config.php
== Some stuff ==
<code>disown -a && exit</code> - выйти не закрывая работающие процессы
== motd ==
https://habr.com/ru/post/529746/
== VirtualBox ==
<code>VBoxManage clonehd absolutepath/image.vdi image.img --format raw</code> - сконвертировать vdi в сырой диск<br>
<code>VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk /dev/sda</code> - создать vmdk который является физическим диском

Текущая версия от 20:20, 24 сентября 2021


fstab

не фейлиться если проблемы

/dev/disk/by-uuid/1bd74118-86ae-4701-b3b0-dfbf0574274e /disks ext4 defaults,noatime,nofail 0 0

открытые процессом файлы

/proc/PIDOF/fd/

сигналы (процессы)

Ctrl+C - SIGINT

SIGTERM ожидает завершения процесса, SIGKILL завершает процесс принудительно, не дожидаясь корректного завершения программы.

https://www.geeksforgeeks.org/segmentation-fault-sigsegv-vs-bus-error-sigbus/

SIGSEGV - Нарушение прав доступа к памяти, например, приложение попыталось записать в Read-only память.

SIGBUS - обращение процесса к некорректному адресу памяти.

The main difference between Segmentation Fault and Bus Error is that Segmentation Fault indicates an invalid access to a valid memory, while Bus Error indicates an access to an invalid address.

SIGCHLD - сигнал отправляет родительский процесс дитенышу, чтобы тот завершил свою деятельность [1]

Состояние процессов

Рекомендую: man ps, раздел "PROCESS STATE CODES"

Больше инфы: http://rus-linux.net/MyLDP/proc/processes-in-Linux.html
Меньше инфы: https://www.k-max.name/linux/processy-v-linux/

Интерактивный режим - процесс переднего плана, имеет состояние со знаком плюс (например R+, S+). Такие процессы ждут ввода от пользователя, такое бывает, например, когда процесс запущен на переднем плане в консоли.

  • Sleep

knflkr 297090 0.0 0.0 5328 648 pts/3 S+ 21:04 0:00 sleep 10000

  • Sleep, Ctrl+z, bg

knflkr 297090 0.0 0.0 5328 648 pts/3 S 21:04 0:00 sleep 10000

PROCESS STATE CODES
       Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") 
       will display to describe the state of a process:

               D    uninterruptible sleep (usually IO)
               I    Idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an event to complete)
               T    stopped by job control signal
               t    stopped by debugger during the tracing
               W    paging (not valid since the 2.6.xx kernel)
               X    dead (should never be seen)
               Z    defunct ("zombie") process, terminated but not reaped by its parent

       For BSD formats and when the stat keyword is used, additional characters may be displayed:

               <    high-priority (not nice to other users)
               N    low-priority (nice to other users)
               L    has pages locked into memory (for real-time and custom IO)
               s    is a session leader
               l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
               +    is in the foreground process group

nextcloud preview configuration

I don't want to generate all the preview sizes


This is possible since version 1.0.8. Just set the correct values via the command line

./occ config:app:set --value="32 64 1024" previewgenerator squareSizes
./occ config:app:set --value="64 128 1024" previewgenerator widthSizes
./occ config:app:set --value="64 256 1024" previewgenerator heightSizes


This will only generate:

  • square previews ofL 32x32, 64x64 and 1024x1024* aspect ratio previews with a width of: 64, 128 and 1024
  • aspect ratio previews with a height of: 64, 256 and 1024


Note:

  • preview sizes are always a power of 2.
  • The smallest size is 32
  • The max size is determined by your preview settings in config.php

Some stuff

disown -a && exit - выйти не закрывая работающие процессы

motd

https://habr.com/ru/post/529746/

VirtualBox

VBoxManage clonehd absolutepath/image.vdi image.img --format raw - сконвертировать vdi в сырой диск
VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk /dev/sda - создать vmdk который является физическим диском