stop_process(){ echo "checking running process..." processName="AOne" if pgrep -x "$processName" >/dev/null; then echo "$processName is running,stopping..." killall -e $processName fi } stop_service(){ echo "checking running service..." serviceName="aone.service" num=`systemctl status $serviceName|grep "Active"|grep "running"|wc -l` if [ $num -ne 0 ]; then echo "$serviceName is running,stopping..." systemctl stop $serviceName systemctl disable $serviceName fi } pre_install(){ stop_service stop_process } post_install(){ bash /opt/AOne/control-scripts/postinst } pre_remove(){ bash /opt/AOne/control-scripts/prerm bash /opt/AOne/control-scripts/postrm } post_remove(){ stop_service stop_process rm -rf /etc/systemd/system/aone.service rm -rf /opt/AOne }