github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/packaging/rpm/control/preun (about)

     1  #!/bin/sh
     2  
     3  set -e
     4  
     5  [ -f /etc/sysconfig/cortex ] && . /etc/sysconfig/cortex
     6  
     7  # Final uninstallation $1=0
     8  # If other copies of this RPM are installed, then $1>0
     9  if [ $1 -eq 0 ] ; then
    10      if command -v systemctl 2>/dev/null; then
    11  	systemctl stop cortex.service > /dev/null 2>&1 || :
    12      fi
    13  fi