https://www.ip2location.com/free/visitor-blocker

  1. Head to the IP2Location Firewall IP list tool.
  2. Select the country you want to block or allow.
  3. Choose between IPv4 and IPv6 in the IP Version menu.
  4. Choose the format in the Output Format menu. The choice depends on whether you want to block or allow visitors from those countries.
  5. Click Download.

#!/bin/bash

# Set the input file and command
INPUT_FILE="users.txt"
COMMAND="/usr/local/directadmin/directadmin admin-backup --destination=/home/admin/admin_backups/$

# Read the users from the file
while IFS= read -r username; do
  # Run the command for each user
  ${COMMAND} --user=${username}
done < "${INPUT_FILE}"

users.txt

user1
user2
blabla
hort
zort
mort

llama3 latest yazdi
conversation su sekilde calisti:

You

help me create a bash script where the command is /usr/local/directadmin/directadmin admin-backup –destination=/home/admin/admin_backups –user=testuser1 –user=testuser2 –user=testuser3 testuser1 testuser2 testuser3 lines are read from an external text file each on its own line

llama3:latest

Here is a bash script that reads the usernames from an external text file and runs the command for each user:

bash#!/bin/bash

# Set the input file and command
INPUT_FILE="users.txt"
COMMAND="/usr/local/directadmin/directadmin admin-backup --destination=/home/admin/admin_backups"

# Read the users from the file
while IFS= read -r username; do
  # Run the command for each user
  ${COMMAND} --user=${username}
done < "${INPUT_FILE}"

Let me explain what’s going on:

  1. The first line, #!/bin/bash, specifies the interpreter that should be used to run the script.
  2. We set the input file (users.txt) and command (COMMAND variable) at the top of the script.
  3. The while loop reads each line from the input file using IFS= read -r username. The -r option tells read to treat backslashes as literal characters, rather than interpreting them as escape sequences. This is important if your usernames contain special characters.
  4. Inside the loop, we run the command for each user by concatenating the COMMAND variable with the --user= parameter and the current username.

To use this script, simply create a file called users.txt in the same directory as the script, with one username per line:

texttestuser1
testuser2
testuser3

Then, make the script executable by running chmod +x scriptname.sh, and then run it by typing ./scriptname.sh.

Note: Make sure to replace users.txt with the actual path to your input file if it’s located elsewhere.

tarih 4 ekim 24

# Switching / updating PHP versions

Make a backup

    tar czvf ~/domain-conf-backup.tgz /usr/local/directadmin/data/users/**/domains/*.conf

Force PHP to be version 1 if no default is set

    grep -rF -L php1_select /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step1 '$ a php1_select=1'

Change new version to temporary position

    grep -rF -l 'php1_select=3' /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step2 's/^php1_select=3/php1_select=31/'

Change old version to old position

    grep -rF -l 'php1_select=1' /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step3 's/^php1_select=1/php1_select=3/'

Change new version to new position

    grep -rF -l 'php1_select=31' /usr/local/directadmin/data/users/**/domains/*.conf | xargs sed -i.step4 's/^php1_select=31/php1_select=1/'

Adjust PHP versions inside custombuild

    DO THIS MANUALLY

Rewrite config files

    cd /usr/local/directadmin/custombuild && ./build rewrite_confs

konsoldan sunucu saatini , php saatini ve mariadb saatini tek komutla kontrol edelim.

cat /usr/local/directadmin/conf/mysql.conf

# date ; php -r "echo date('r').PHP_EOL;" ; mysql -u da_admin -p -e "SELECT NOW();"

[root@zubuk ~]# cat /usr/local/directadmin/conf/mysql.conf 
user=da_admin
passwd=benimguzelpaswordum
[root@zubuk ~]# date ; php -r "echo date('r').PHP_EOL;" ; mysql -u da_admin -p -e "SELECT NOW();"
Tue Sep 10 11:25:06 +03 2024
Tue, 10 Sep 2024 11:25:06 +0300
Enter password: 
+---------------------+
| NOW()               |
+---------------------+
| 2024-09-10 11:25:15 |
+---------------------+
[root@zubuk ~]# 

peki ya sunucuda bulunan diger php ?

[root@zubuk ~]# date ; /usr/local/php82/bin/php -r "echo date('r').PHP_EOL;" ; mysql -u da_admin -p -e "SELECT NOW();"
Tue Sep 10 11:31:42 +03 2024
Tue, 10 Sep 2024 11:31:42 +0300
Enter password: 
+---------------------+
| NOW()               |
+---------------------+
| 2024-09-10 11:31:52 |
+---------------------+
[root@zubuk ~]# 

3 php var sistemde diyelim

1- php 8.3
2- php 7.4
3- php 5.6

hangi kullanici hangi php surumunu kullaniyor?

egrep php[1,2,3,4]_select= /usr/local/directadmin/data/users/*/domains/*.conf

listede cikan 2 ise 7.4, 3 ise 5.6, hic bir sey cikmaz ise 8.3

8.3 icin user.conf icinde veri yok demekki cunku default php, degistiriledi ise kayit olmaz

centos 7 oldu

yum calismiyo 404 ,

napiyoruz?

https://almalinux.org/blog/2024-07-09-centos7-updates

centos vault da var , ama vault nedir ya ? en azindan mevcut centos 7 den bir kere son kez guncellensin

vaulta elle ayar cekmek istemiyorum

alma sagolsun tutuyor son kopyasini

ne iyi insanlar

sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://el7.repo.almalinux.org/centos/CentOS-Base.repo
sudo yum upgrade -y

sonra hatta elevate servisi var centos 7 den alma linux 8 veya 9 a gecmek icin

ancak sunucular directadmin

daha once yapan yokmu nedir nedir?

https://forum.directadmin.com/threads/how-to-inplace-upgrade-from-centos-7-to-almalinux-8-5.64994

nano blockla

#!/bin/bash
iptables -A INPUT -s $1 -j DROP
iptables-save > /etc/sysconfig/iptables

ctrl+x y

chmod +x blokla

./blokla ip veya subnet

iptables -L

te amk bebe seyleriyle ugrasiyoz.

Host serverName
    HostName 192.168.1.123
    User userOnServer
    Port 22
    IdentityFile ~/path/to/key

1- login to old server containing data

2- cd /home

ls -1

cp to a text file

delete unwanted users in that file

3- login to new server

ssh-copy-id root@old.ser.ver.ip

nano list.txt

enter user list one in a line

4- nano imap-sync

for E in `cat list.txt`; do rsync -ave 'ssh -p 22' 37.247.xx.xx:/home/$E/imap/ /home/$E/imap/ ; done

sh imap-sync

5- cd /usr/local/directadmin/scripts
./set_permissions.sh all

done!