milis/bin/servis

26 lines
508 B
Plaintext
Raw Permalink Normal View History

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