WGET with UserAgent, random-wait and depth level

Submitted by Gast (nicht überprüft) on So, 12/06/2020 - 14:04

WGET do:

  1. Download example.com
  2. Download all level-1 and level-2 links
  3. Download everything to : /root/t3mp/wget
  4. Identify as 'Mozilla/MyUserAgent'
  5. Ignore robots.txt
  6. Random wait between requests (average : 3 seconds)



wget -U 'Mozilla/MyUserAgent' -P /root/t3mp/wget --wait=3 --random-wait -nd -r -l 2 -e robots=off https://example.com

 

MySQL / MariaDB : alle DBs schnell exportieren

Submitted by Gast (nicht überprüft) on Sa, 12/05/2020 - 04:23

Mysql export kann sehr lange dauert, wenn man viele und große Datenbanken hat. Damit man schnell ein Backup von allen DBs erstellen kann:

mysqldump --opt --quick --all-databases > /root/backup/mysql/alldbs.sql
  
  

Wenn User login notwendig ist :

mysqldump -u root -p --opt --quick --all-databases > /root/backup/mysql/alldbs.sql

 

Linux Shell Loop : For (5x), While (endless) - One Line / Multiline

Submitted by Gast (nicht überprüft) on Di, 11/24/2020 - 02:38

While (endless, stop: CTRL+C)

while : 
 do 
  date
  echo "Hello "
  sleep 5
 done

Alternativ:

while : ; do date; echo "Hello "; sleep 6; done

 

For (5x):

for i in {1..5}
do
   echo "Number is $i "
   sleep 2
done

 Alternativ 1:

for i in {1..5}; do echo "Number is $i "; sleep 2; done

 

 Alternativ 2:

for i in {1..5}; do echo "Number is $i " && sleep 2; done