Knowledge Base

Bash Script to Check and restart services in linux

#!/bin/bash

read -p "Enter Your Service " x

y=(/etc/init.d/$x status)

a=(pgrep $y)

if [ ! $a==0 ]
then
echo "Service Loading FINE"
else
/etc/init.d/$x restart
fi
Newer Post Older Post Home

Search This Blog

My Linux

  • ►  2013 (2)
    • ►  August (2)
  • ►  2011 (16)
    • ►  September (6)
    • ►  July (4)
    • ►  June (3)
    • ►  March (2)
    • ►  January (1)
  • ▼  2010 (32)
    • ►  July (11)
    • ▼  June (21)
      • Install NTPD Daemon to enable NTP in Linux [GPS]
      • Configure LAMP server (Linux + Apache + MySQL + PH...
      • How to send mail using telnet command
      • How to flush DNS cache in ubuntu
      • Access Modem in Linux
      • How do you disable Mailscanner for outgoing but en...
      • Bash Script Display Domain Owner Information
      • Bash Script to Check and restart services in linux
      • Most useful command to monitor Linux Server
      • Installing VMWare for Linux
      • How to unlock vps
      • VTONF on OpenVz
      • Cloning of vps on same machine
      • Backup/Restore CT on OpenVZ
      • Create CT on OpenVz
      • OpenVZ On CentOS
      • Linux mirroring does not copy over grub, so whenev...
      • Recover MySQL database server password
      • How to start Windows Services
      • How to bind Qmail to specific IP address
      • Command to check motherboard information in Linux
Simple theme. Theme images by luoman. Powered by Blogger.