Magellan Linux

Contents of /alx-src/trunk/alx-web/unused/check_services.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 355 - (show annotations) (download) (as text)
Mon Oct 10 19:42:06 2005 UTC (18 years, 6 months ago) by niro
File MIME type: application/x-sh
File size: 471 byte(s)
cvs import: alx-web for alxconfig-ng
 - code clean up and
 - reorganized the whole structure

1 #!/bin/bash
2
3 IP="$1"
4 SERVICE="$2"
5 OP="$3"
6 RETVAL=1
7
8 case ${OP} in
9 status)
10 i="$(/usr/bin/ssh -l root ${IP} /etc/init.d/${SERVICE} ${OP} | grep 'not running')"
11 if [ -z "${i}" ]
12 then
13 RETVAL=0
14 else
15 RETVAL=1
16 fi
17 ;;
18 start|stop)
19 echo -n "${OP}ing ${SERVICE} on ${IP} ... "
20 /usr/bin/ssh -l root ${IP} /etc/init.d/${SERVICE} ${OP} $> /dev/null
21 RETVAL=$?
22 if [[ ${RETVAL} -eq 0 ]]
23 then
24 echo "OK"
25 else
26 echo "FALSE"
27 fi
28 ;;
29 esac
30
31 exit ${RETVAL}

Properties

Name Value
svn:executable *