github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/cookbooks/proxyfs/files/default/usr/bin/stop_proxyfsd_only (about)

     1  #!/bin/bash
     2  
     3  # A simple script to start or stop proxyfsd
     4  # The PATH, etc should already be setup by systemctl environment
     5  
     6  function await_proxyfsd_shutdown {
     7      while true
     8      do
     9          pidof proxyfsd > /dev/null
    10          if [ $? -ne 0 ]
    11          then
    12              break
    13          fi
    14          echo "Waiting for ProxyFS to be stopped..."
    15          sleep 1
    16      done
    17  }
    18  
    19  function await_pfsagentd_shutdown {
    20      while true
    21      do
    22          pidof pfsagentd > /dev/null
    23          if [ $? -ne 0 ]
    24          then
    25              break
    26          fi
    27          echo "Waiting for PFSAgent to be stopped..."
    28          sleep 1
    29      done
    30  }
    31  
    32  if [ -f /usr/bin/systemctl ]; then
    33      # Centos
    34      sudo /usr/bin/systemctl stop pfsagentd
    35      await_pfsagentd_shutdown
    36      sudo /usr/bin/systemctl stop proxyfsd
    37      await_proxyfsd_shutdown
    38  else
    39      # Ubuntu (not tested!)
    40      sudo /usr/sbin/service proxyfsd stop
    41      await_proxyfsd_shutdown
    42  fi