Sample script for URL check
This article mainly introduces the URL check script examples, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
URL check
#! / bin/bash
Path=/home/scripts
MAIL_GROUP= "12306@qq.com 123456@163.com"
PHOTO_GROUP= "13502693568 18023569846"
. / etc/init.d/functions
Check_count=0
Url_list (
Http://www.baidu.com
Https://blog.51cto.com
Http://www.qq.com
Http://192.168.1.5
)
Functions wait ()
{
Echo-n'3 seconds to start checking UEL operation'
For ((iTuno)
If [$?-eq 0]
Then
Action "${url_list [$I]}" / bin/true
Else
Action "${url_list [$I]}" / bin/false
Fi
Done
((check_count++))
}
Functions MAIL () {
For user in `echo $MAIL_ group`
Do
Mail-s "$content" $user > $passdile
If [#?-eq 0]
Then
Action "$user$num is ok" / bin/true
Else
Action "$user$num is fail" / bin/false
Fi
Done
Echo "# creation completed #"
Echo "Please check your account and password in / tmp/user.log"
#
Nginx start
#! / bin/bash
# chkconfig 2345 50 98
Path=/usr/local/nginx/sbin
Pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
. / etc/init.d/functions
Start () {
If [`netstat-lunpt | grep nginx | wc-l`-eq 0]; then
$pash/nginx
RETVAL=$?
If [$RETVAL-eq 0]; then
Action "nginx is started" / bin/true
Return $RETVAL
Else
Action "nginx is started" / bin/false
Return $RETVAL
Fi
Else
Echo "nginx is running"
Return 0
Fi
}
Stop () {
If [- f $pid]
$path/nginx-s stop
RETVAL=$?
If [$RETVAL-eq 0]; then
Action "nginx is stoped" / bin/true
Return $RETVAL
Else
Action "nginx is stoped" / bin/false
Return $RETVAL
Fi
Else
Echo "nginx is not running"
Return $RETVAL
Fi
}
Case "$1" in
Start)
Start
RETVAL=$?
Stop)
Stop
RETVAL=$?
Restart)
Stop
Sleep 1
Start
RETVAL=$?
*)
Echo $"Usage: $0 {start | stop | restart}"
Exit 1
Esac
Exit $RETVAL
#
Random password production
Six different methods of Random password production
# randomly generate 10-digit passwords
Echo "helloboy$RANDOM" | md5sum | cut-c 3-13
Openssl rand-base64 10
Date +% s% N | md5sum | cut-c 2-12
Head / dev/urandom | cksum | md5sum | cut-c 2-12
Mkpasswd-l 9-d 2-c 3-C 3-s 1 | md5sum | cut-c 3-13
Echo "`openssl rand-base64 10`" | passwd-- stdin username > > / tmp/1.log
Turn off unwanted services
Chkconfig | egrep-vE "crond | sshd | network | rsyslog | sysstat" | awk'{print "chkconfig", $1, "off"}'| bash
Thank you for reading this article carefully. I hope the article "script examples of URL checking" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!