[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: script to turn off services

inode0 wrote:
On 8/16/06, Bill Tangren <bjt aa usno navy mil> wrote:
I am trying to write a script that will turn off unneeded services, but I am not
having any luck. I have tried the following:

service bluetooth status > /dev/null 2>&1
if [ $EXITVALUE == 0 ]; then
    service bluetooth stop
    chkconfig --level 345 bluetooth off

This works if bluetooth is not installed, but not if it IS installed and already turned off. In that case, the service command returns zero and the if block is

Does anyone know how to modify this script so that it will run (or tell me where
I can learn how to modify it)?

Why do you care what state it is in if you know you want it off?

Yes. I was hoping for something a little more elegant. That's all.

Doesn't something simple (albeit parts may be unnecessary but
shouldn't cause any harm) like

for u in "list of unneeded services"; do
 service $u stop
 chkconfig $u off

work ok?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]