servis 508 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. if [ -z "$1" ]; then
  3. echo "kullanım: servis <servicename> start|stop|restart"
  4. exit 1
  5. else
  6. _servis=$1
  7. if [ ! -f /etc/init.d/$_servis ]; then
  8. echo "$_servis servisi bulunamadı."
  9. exit 1
  10. fi
  11. fi
  12. if [ -z "$2" ]; then
  13. echo "kullanım: servis <servicename> start|stop|restart|status|durum"
  14. exit 1
  15. else
  16. _islev=$2
  17. fi
  18. if [ $2 == "durum" ];then
  19. servis $_servis status | grep 'is running' > /dev/null && [ $? -eq 0 ] && echo "aktif" || echo "pasif"
  20. else
  21. /etc/init.d/$_servis $_islev
  22. fi