milis/bin/servis

26 lines
508 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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