github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/cookbooks/proxyfs/files/default/usr/bin/stop_proxyfsd_only (about)

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