Perl batch removes the program binding process of the shengteng terminal to solve the 100% CPU usage problem.

Source: Internet
Author: User

Requirement: colleagues report that the server is difficult to log on to the terminal every afternoon and does not respond for a long time.
After investigation, the shengteng terminal binding program and each terminal have a large number of invalid connections (Perl obtains the external IP information connecting to the local machine). Even if the resources occupied by the terminal offline are not released, the next connection recreates a new connection, which is repeated. The CPU usage reaches 100% when the available resources of the server are exhausted.
As mentioned above, I personally set the bug of the shengteng program. After contacting the manufacturer, I have not provided a solution. I am writing this program temporarily to manually recycle the resources that have been occupied too much.
Advantage: the batch kill program quickly recycles occupied resources.

#! /Usr/bin/perl-wuse strict; ######################################## ##################### file: kill_centerm.pl # function: Kill the running centermtelnetd process on the terminal. # requirement: My colleagues report that the server is difficult to log on to the terminal every afternoon, and the service is handled. # No response is returned for a long time. # After investigation, the shengteng terminal binding program has a large number of invalid connections with each terminal. Even if the resources occupied by terminal # offline are not released, a new connection is created at the next connection, # repeat. Until the available resources of the server are exhausted and the CPU usage is 100% # As mentioned above, the personal setting is a rising program bug. After contacting the manufacturer, no solution is provided for the time being. # compile this program to manually recycle the resources occupied too much. # Advantage: Batch kill programs can quickly recycle occupied resources. # Version: v0.1 # Time: # Author: semi-idle # Test Platform: # sco_sv scosysv 3.2 5.0.6 i386 ################################## ######################################## ################# PS: #-e displays all processes and environment variables; #-f full format; #-l long format; ############################ open (CEN, "PS-elf |") or die "can't open wordcount: $! "; While (<CEN>) {# extract # S (State of the Process) domain # R: Running State (runnig) pidif (/r \ s + \ W + \ s + (\ D + ). * center. * $/) {print "$ & \ n" If kill-9, $1 ;}} close CEN;

TOP Command page when occupied:

Related Article

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.