milis/bin/servis

26 lines
508 B
Text
Raw Normal View History

2017-03-23 00:07:38 +02:00
#!/bin/bash
if [ -z "$1" ]; then
echo "kullanım: servis <servicename> start|stop|restart"
exit 1
2018-07-15 09:38:46 +03:00
else
_servis=$1
if [ ! -f /etc/init.d/$_servis ]; then
echo "$_servis servisi bulunamadı."
exit 1
fi
2017-03-23 00:07:38 +02:00
fi
2018-07-15 09:38:46 +03:00
if [ -z "$2" ]; then
echo "kullanım: servis <servicename> start|stop|restart|status|durum"
2017-03-23 00:07:38 +02:00
exit 1
2018-07-15 09:38:46 +03:00
else
_islev=$2
2017-03-23 00:07:38 +02:00
fi
2018-07-15 09:38:46 +03:00
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