31 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Periodically scan a directory tree to prevent files from being reaped5# by systemd and friends on long runs.6#7# Usage: kvm-remote-noreap.sh pathname8#9# Copyright (C) 2021 Facebook, Inc.10#11# Authors: Paul E. McKenney <paulmck@kernel.org>12 13pathname="$1"14if test "$pathname" = ""15then16 echo Usage: kvm-remote-noreap.sh pathname17 exit 118fi19if ! test -d "$pathname"20then21 echo Usage: kvm-remote-noreap.sh pathname22 echo " pathname must be a directory."23 exit 224fi25 26while test -d "$pathname"27do28 find "$pathname" -type f -exec touch -c {} \; > /dev/null 2>&129 sleep 3030done31