Service script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Service script
# 8  
Old 05-27-2013
Hi MadeIn,

Want to make sure to "NOTOK" if any one is ON.
# 9  
Old 05-27-2013
Code:
if chkconfig --list telnet | grep -w 'on'
then
  echo " telnet configured for autostart : STATUS--> NOOK"
  echo
else
  echo " telnet not configured for autostart : STATUS--> OK"
  echo
fi

# 10  
Old 05-27-2013
Hi MadeIn,

I got the error while using the script like below:

Code:
if chkconfig --list telnet | grep -w 'on' 
then   echo " telnet configured for autostart : STATUS--> NOOK" 
  echo 
else 
  echo " telnet not configured for autostart : STATUS--> OK"   
echo 
fi

Code:
ERROR : error reading information on service telnet: No such file or directory[/QUOTE]Even I tried with the below script: no luck.

[QUOTE]if chkconfig --list  | grep -i telnet | grep -w 'on'
then
        echo "telnet is disabled: STATUS--> OK"
        echo
else
        echo "telnet is enabled: STATUS--> NOTOK"
        echo
fi
echo


Last edited by Scott; 05-28-2013 at 02:46 AM.. Reason: Code tags, please...
# 11  
Old 05-28-2013
My last post was mistaken; indeed there must be chkconfig --list | grep
Code:
if chkconfig --list | grep 'telnet.*[[:blank:]]on'
then
  echo " telnet configured for autostart : STATUS--> NOOK"
  echo
else
  echo " telnet not configured for autostart : STATUS--> OK"
  echo
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script to automate a service message

Hi I am trying to figure out, on how to automate whether in a simple script or using awk/sed/grep commands to automate a "service.message" file which has tag separated message stating as; "There is currently no outage or system is unavailable for duration of change....", therefore, when... (14 Replies)
Discussion started by: Gamma
14 Replies

2. UNIX for Beginners Questions & Answers

Run one service after another service has finished - systemd

Hi all I would like to know how to run task2.service after task1.service has finished. task1.service has a timer (task1.timer), that makes it run every 5 minutes OnCalendar=*:0/5task2.service is basically a script, that has to work on the files created after task1 has finished. This is what I... (2 Replies)
Discussion started by: guilliber
2 Replies

3. Shell Programming and Scripting

Shell script for service

Hi, I want to add an application as a service in Linux(Fedora 12). It should be run always for monitoring my system. It never terminate unless kill it. I wrote this script, put it on /etc/init.d/myapp and added it to run level 2345: #!/bin/bash # # chkconfig: 2345 20 80 # description:... (3 Replies)
Discussion started by: pronetin
3 Replies

4. Shell Programming and Scripting

script for monitoring service

Hi, I am new to shell programming, I would like to write a script which will monitor sendmail service in linux, and if service goes down it will send the mail can you please suggest me how to monitor the service? Regards, Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

5. UNIX for Dummies Questions & Answers

Making a Script to Start as a Service

Hi, I have a shell script t1.sh. on my solaris box. So, what are the steps required to make this script run as a Service, when the system re-starts. (for ex:- at run level 3). I know that I should use the rc.d folders. But I don't know the exact steps. Kindly explain, Thanks in... (3 Replies)
Discussion started by: S.Vishwanath
3 Replies

6. Shell Programming and Scripting

Getting a script to find another script via lookup service

Hi, I'm trying to write a basic script which will measure throughput at a node on a network, and pass the results on to a manager script (running on another node on the same network). I presume that I need to use some sort of naming service, so that the manager can publish its location. From what I... (2 Replies)
Discussion started by: zeppelin147
2 Replies
Login or Register to Ask a Question