su nobody -s /bin/sh -c ‘cat /tmp/some_test’
cat: /tmp/some_test: Permission denied
curl list index elasticsearch
curl 'localhost:9200/_cat/indices?v'
elasticsearch delete index older than
bash script rotate-elasticsearch-index.sh
should to change regDate=”$yearReg\\-$monthReg\\-$dayReg” to match your index date format
curl -X PUT “localhost:9200/test_2022-08-02-test?pretty”
{
“acknowledged” : true,
“shards_acknowledged” : true,
“index” : “test_2022-08-02-test”
}
./rotate-elasticsearch-index.sh test localhost:9200 1
=== Fri Aug 12 16:35:37 EEST 2022 ===
——————————————-
INFO: Index: test_2022-08-11-110602
INFO: Found date: 2022-08-11
INFO: test_2022-08-11-110602 is less than 1 days old, doing nothing.
——————————————-
INFO: Index: test_2022-08-12-110602
INFO: Found date: 2022-08-12
INFO: testas_2022-08-12-110602 is less than 1 days old, doing nothing.
——————————————-
INFO: Index: test_2022-08-02-test
INFO: Found date: 2022-08-02
DELETE: test_2022-08-02-test is about to be deleted.
sed add text to end of line after match
sed -i '/^search_string\=/ s/$/,text_to_add/' file
sed add new line after match
sed -i 's/search_string/&\n/g' file
Dockerfile icecoder
FROM php:7.4.10-apache MAINTAINER ICEcoder <[email protected]> ENV DEBIAN_FRONTEND noninteractive RUN a2enmod rewrite RUN a2enmod ssl RUN service apache2 restart RUN apt-get update && \ apt-get install unzip -y && \ apt-get clean all && \ curl -o /icecoder.zip 'https://downloads.icecoder.net/ICEcoder-8.1.zip' && \ unzip -q /icecoder.zip -d /tmp/ && \ cp -r /tmp/ICE* /var/www/html/icecoder && \ echo "<!DOCTYPE html>\n<html>\n<head>\n<title>Welcome to your new site</title>\n</head>\n<body style=\"text-align: center; font-family: monospace\">\n<h1>Welcome!</h1>\n<p>Head to ICEcoder at <a href=\"/icecoder\">localhost:8080/icecoder</a> to create a password and start coding!</p>\n</body>\n</html>" > /var/www/html/index.php && \ chown -R www-data.www-data /var/www/html && \ chmod 755 /var/www/html && \ rm -rf /icecoder.zip /tmp/ICE*
monit rabbitmq
check process rabbitmq-server matching "/usr/lib/erlang/erts-6.2/bin/beam"
group rabbitmq
start program = "/etc/init.d/rabbitmq-server start"
stop program = "/etc/init.d/rabbitmq-server stop"
if failed port 5672 type tcp then restart
if 3 restarts within 3 cycles then timeout
mysql find pid file location
/usr/sbin/mysqld --print-defaults | tr " " "\n" | grep pid | tail -n 1
bash smtp auth
echo "PUT YOUR MAIL BODY HERE" | mailx -s "SUBJECT" -S smtp=smtp://yoursmtpserver.com -S smtp-auth=login -S smtp-auth-user=YOUR_USERNAME -S smtp-auth-password=YOUR_PASSWORD -S from="Sender Name
Error: Failed to download metadata for repo
cd /etc/yum.repos.d/
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-*
wg-dashboard reset password
find /opt/wg-dashboard/ -iname server_config.json
Remove current user from json array:
{
“id”: 1,
“username”: “xxx”,
“password”: “xxx
}
systemctl restart wg-dashboard.service
Access http://vpn_server_ip/createuser to create new user
bash extract domain from url
echo "https://www.srv24x7.com/" | sed -e 's|^[^/]*//||' -e 's|/.*$||'
nginx plugin certbot
apt install certbot python3-certbot-nginx
mysql find error log
tail -f $(mysql -Nse "SELECT @@GLOBAL.log_error")
mysql replication skip errors
auto skip
until mysql -e "show slave status\G;" | grep -i "Slave_SQL_Running: Yes";do
mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;";
sleep 1;
done