如何制作一个wget和mysql bash脚本

时间:2021-02-19 01:47:24

I want to make a bash script that will get a bunch of urls from a mysql table and pass all the urls one by one to the wget --spider , and update the mysql with the response code from wget: "HTTP request sent, awaiting response... 200 OK" I really don't know where to start from .. Thank you

我想创建一个bash脚本,它将从mysql表中获取一堆url并将所有url一个接一个地传递给wget --spider,并使用wget的响应代码更新mysql:“发送HTTP请求,等待回答... 200 OK“我真的不知道从哪里开始......谢谢

1 个解决方案

#1


0  

#!/bin/bash

DBNAME=DB_NAME
USER=USER
PASS=PASS
HOST=localhost
STATEMENT="select name from environment;"

COUNTER=$(mysql $DBNAME -h $HOST -u$USER -p$PASS  -e "$STATEMENT")

for entry in $COUNTER; do
  echo wget $entry
done

Here is the output

这是输出

 ./mql.sh 
wget name
wget Prod
wget uat

#1


0  

#!/bin/bash

DBNAME=DB_NAME
USER=USER
PASS=PASS
HOST=localhost
STATEMENT="select name from environment;"

COUNTER=$(mysql $DBNAME -h $HOST -u$USER -p$PASS  -e "$STATEMENT")

for entry in $COUNTER; do
  echo wget $entry
done

Here is the output

这是输出

 ./mql.sh 
wget name
wget Prod
wget uat