Multithreading to determine whether a user is online (running ping scripts in the background)

Source: Internet
Author: User

#!/bin/bash#writen by jerryfor i in $ (seq 1 255);   do      {        ping 192.168.51. $i  -c  2 >> /dev/null 2>&1     #无论ping到ping不到都不在前台显示          tai=$ (echo $?)         if [  $tai  == 0 ];             then                 echo -e  "\033[1;32m 192.168.51. $i  is  online \033[0m "     #加重颜色显示online              else                 echo -e  "\033[1;35m 192.168.51. $i  is offline \033[0m "     #同上         fi         }&   done    wait     echo  "all finished!"


This article is from the "operation and maintenance of life" blog, please make sure to keep this source http://jinyan2049.blog.51cto.com/881440/1948123

Multithreading to determine whether a user is online (running ping scripts in the background)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.