python script to check server status

Today lets write a simple script to chek the Apache server status using python.

create a simple file called server_check on your desktop, copy and paste the below code

Now lets execute and check.

open your terminal and navigate to the desktop and type the following command.

python check_service

then it will ask for a service name “Please enter service name :”

enter the service name eg: apache2 or mysql

you will see a output like this.

Screenshot from 2016-05-11 10-26-28

Today. i Upgraded the script, so that it can be more usable on server. This will support on Python 2.7+ only. checkout the sample script below.