Инструменты пользователя

Инструменты сайта


os:centos

Новый раздел

yum install e2fsprogs
fdisk /dev/sd**b**
p
n
e
1
enter
enter
p
t
L
83
w
mkfs -t ext2 /dev/sd**b**
fsck.ext2 -f /dev/sd**b**
mount /dev/sdb /mnt/10G
 
blkid /dev/sd**b**
/dev/sd**b**: UUID=d426ab14-6f1b-4799-ac9a-023bcb6e51e4 BLOCK_SIZE="4096" TYPE="ext2"
nano /etc/fstab
UUID=d426ab14-6f1b-4799-ac9a-023bcb6e51e4 /mnt/10G                ext2    defaults        0 0

rsyslog

+ Сбор логов

systemctl status rsyslog
nano /etc/rsyslog.conf
 
module(load="imudp") # needs to be done just once
input(type="imudp" port="514")
 
# Logging much else clutters up the screen.
$umask 0022
$template FILENAME,"/mnt/10G/mikrotik/logs/%fromhost-ip%.log"
if $fromhost-ip != '127.0.0.1' then ?FILENAME
& stop
 
systemctl restart rsyslog

log rotate

nano /etc/logrotate.d/mikrotik
 
/mnt/10G/mikrotik/logs/*.log {
        weekly
        rotate 3
        compress
        olddir /mnt/10G/mikrotik/logs/old
        missingok
        notifempty
        create 0640 root zabbix
}

sshpass

sudo dnf install epel-release -y
sudo dnf install sshpass -y

scp multi host

#!/bin/bash
 
while read line; do
    array[$index]="$line"
        index=$(($index+1))
    done < /mnt/10G/mikrotik/hosts.conf
for ((a=0; a < ${#array[*]}; a++))
do
    remote=`echo ${array[$a]} | awk '{ print $1 }'`
    echo "$name begin";
    sshpass -p PASS scp -P PORT -o StrictHostKeychecking=no LOGIN@$remote:$remote.backup /mnt/10G/mikrotik/backups/. &
 
    echo "$name end";
done
%
os/centos.txt · Последнее изменение: 25.05.2022 11:27 — kubada