#!/bin/bash

COUNT=`netstat -ntlp | grep rpc | wc -l`

if [ $COUNT -eq 0 ];then
    systemctl restart nfs-kernel-server.service

    sleep 2
    if [ `ps -C nfsd --no-header |wc -l` -eq 0 ];then
        killall keepalived
    fi
fi
