Архив

Архив раздела ‘Linux’
15 октября 2024 Нет комментариев

Автоматический перезапуск tomcat если он не активен

#!/bin/bash
TOMCAT_PID=$(ps -ef | awk '/[t]omcat/{print $2}')
echo TOMCAT PROCESSID $TOMCAT_PID
if [ -z "$TOMCAT_PID" ]
then
	echo "TOMCAT NOT RUNNING"
	service tomcat restart
else
	echo "TOMCAT RUNNING"
fi
Categories: Linux Tags:
8 августа 2024 Нет комментариев

При ошибке обновления:
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=genclo error was

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Categories: Linux Tags:
12 сентября 2023 Нет комментариев
ls -l ./ | sed -n 's~^-.*\(\..*\)$~\1~p' | sort | uniq
Categories: Linux Tags:
grep "/test/" ./log.log | cut -d ' ' -f 1 | sort | uniq -c | sort -n | tail -n 30

Источник: https://habr.com/ru/articles/236771/

Categories: Linux Tags:
iptables -A INPUT -s 192.168.10.10 -j DROP
Categories: Linux Tags:
28 февраля 2023 Нет комментариев
cat access.log | cut -d'"' -f 6 | grep bot | sort | uniq

Заблокировать лишних в .htaccess

SetEnvIfNoCase User-Agent "AhrefsBot|DotBot|SemrushBot|PetalBot" bad_bot
<Limit GET POST HEAD>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</Limit>
Categories: Linux Tags:
22 февраля 2023 Нет комментариев
find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn

Второй вариант:

du -a . | cut -d/ -f2 | sort | uniq -c | sort -rn
Categories: Linux Tags: