From 1da9b758e88370d6cfe115d0b0de61a97b059fd6 Mon Sep 17 00:00:00 2001 From: milisbir Date: Sun, 15 Jul 2018 09:38:46 +0300 Subject: [PATCH] servis --- bin/servis | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/bin/servis b/bin/servis index 7153e9ebb..90771d97a 100755 --- a/bin/servis +++ b/bin/servis @@ -3,11 +3,23 @@ if [ -z "$1" ]; then echo "kullanım: servis start|stop|restart" exit 1 +else + _servis=$1 + if [ ! -f /etc/init.d/$_servis ]; then + echo "$_servis servisi bulunamadı." + exit 1 + fi fi -if [ ! -f /etc/init.d/$1 ]; then - echo "$1 servisi bulunamadı." +if [ -z "$2" ]; then + echo "kullanım: servis start|stop|restart|status|durum" exit 1 +else + _islev=$2 fi -/etc/init.d/$1 $2 +if [ $2 == "durum" ];then + servis $_servis status | grep 'is running' > /dev/null && [ $? -eq 0 ] && echo "aktif" || echo "pasif" +else + /etc/init.d/$_servis $_islev +fi