github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/cookbooks/proxyfs/files/default/usr/bin/unmount_and_stop_pfs (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 unmount the sample mount point and stop the services 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 # We need to make sure PFSAgent is stopped before we stop ProxyFS, but we 39 # don't care if other services are stopped in the meantime. 40 await_pfsagentd_shutdown 41 sudo /usr/bin/systemctl stop proxyfsd 42 await_proxyfsd_shutdown 43 sudo /usr/bin/swift-init main stop 44 sudo /usr/bin/systemctl stop memcached 45 else 46 # Ubuntu (not tested!) 47 # Here we should stop pfsagentd, but we don't support Ubuntu 48 sudo /usr/sbin/service proxyfsd stop 49 await_proxyfsd_shutdown 50 sudo /usr/bin/swift-init main stop 51 sudo /usr/sbin/service memcached stop 52 fi