1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0+ 3# 4# Periodically scan a directory tree to prevent files from being reaped 5# by systemd and friends on long runs. 6# 7# Usage: kvm-remote-noreap.sh pathname 8# 9# Copyright (C) 2021 Facebook, Inc. 10# 11# Authors: Paul E. McKenney <paulmck@kernel.org> 12 13pathname="$1" 14if test "$pathname" = "" 15then 16 echo Usage: kvm-remote-noreap.sh pathname 17 exit 1 18fi 19if ! test -d "$pathname" 20then 21 echo Usage: kvm-remote-noreap.sh pathname 22 echo " pathname must be a directory." 23 exit 2 24fi 25 26while test -d "$pathname" 27do 28 find "$pathname" -type f -exec touch -c {} \; > /dev/null 2>&1 29 sleep 30 30done 31