STOP UN-USED SERVICE USING SHELL SCRIPT


[root@node1 sort]# vim list_off_service.txt

anacron
apmd
atd
autofs
cpuspeed
cups
cups-config-daemon
gpm
isdn
netfs
nfslock
openibd
pcmcia
portmap
rawdevices
readahead_early
rpcgssd
rpcidmapd
smartd
xfs
avahi-daemon
avahi-dnsconfd
firstboot
yum-updatesd
mcstrans
bluetooth
hidd
sendmail
xinetd
acpid
microcode_ctl
irqbalance
haldaemon
messagebus
mdmonitor
restorecond
rhnsd
xfs
ip6tables
iptables

:wq!

[root@node1 sort]# vim stop_service.sh


#!/bin/bash
CURR_DIR=`pwd`
for service in `sort $CURR_DIR/list_off_service.txt`
do
        if [ -f /etc/init.d/$service ]; then
                chkconfig --level 12345 $service off
                chkconfig --list | grep $service
                echo ""
        fi
done

:wq!

[root@node1 sort]# chmod +x stop_service.sh

[root@node1 sort]# sh stop_service.sh
Advertisements

One thought on “STOP UN-USED SERVICE USING SHELL SCRIPT

  1. ashley furniture December 31, 2013 at 4:20 pm Reply

    Someone necessarily assist to make severely articles I would state. That is the first time I frequented your web page and thus far? I surprised with the analysis you made to make this particular post extraordinary. Fantastic activity!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: