From 5d52fded9b7ade9af0e43ee79b0b25ab1b779198 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Sun, 29 Aug 2021 00:36:25 -0700 Subject: [PATCH] EX-3389 lipe: add lipe_delete script Usage: lipe_delete [OPTION]... --client-mount=CLIENT_MOUNT -- DEVICE EXPRESSION Scan DEVICE for files matching EXPRESSION and delete the matching files. Mandatory arguments to long options are mandatory for short options too. -c CLIENT_MOUNT, --client-mount=CLIENT_MOUNT Lustre client mount point -d, --debug display debug information --dry-run only display what would be deleted -t THREAD_COUNT, --threads=THREAD_COUNT count of the scanning thread --no-convert do not convert the EXPRESSION -h, --help display this help message and exit -v, --version display version information and exit For expression details see lipe_find(1). For example: $ lipe_delete --dry-run -c /mnt/lustre -- /dev/mapper/mds1_flakey -fid '*' lfs rmfid /mnt/lustre 0x200000408:0x14245:0x0 0x200000408:0x14246:0x0 Test-Parameters: trivial Change-Id: I9ed5247992c807e81ac4445986a07ac0d2196de3 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/44421 Tested-by: jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-on: https://review.whamcloud.com/44971 --- lipe/Makefile.am | 1 + lipe/lipe.spec.in | 2 + lipe/lipe_delete | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100755 lipe/lipe_delete diff --git a/lipe/Makefile.am b/lipe/Makefile.am index 82cdcb5..6c20e18 100644 --- a/lipe/Makefile.am +++ b/lipe/Makefile.am @@ -71,6 +71,7 @@ EXTRA_DIST= \ lipe.spec.in \ lipe_c_check.pl \ lipe_find2 \ + lipe_delete \ lipe-func.sh \ lpcc.conf \ laudit.conf.example \ diff --git a/lipe/lipe.spec.in b/lipe/lipe.spec.in index 1701413..853986e 100644 --- a/lipe/lipe.spec.in +++ b/lipe/lipe.spec.in @@ -225,6 +225,7 @@ cp \ ldsync \ lipe_find \ lipe_find2 \ + lipe_delete \ lipe-func.sh \ lipe_convert_expr \ lipe_run_action \ @@ -409,6 +410,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/lipe_scan2 %{_bindir}/lipe_find %{_bindir}/lipe_find2 +%{_bindir}/lipe_delete %{_bindir}/lipe-func.sh %{_bindir}/lipe_convert_expr %{python2_sitelib}/pylipe diff --git a/lipe/lipe_delete b/lipe/lipe_delete new file mode 100755 index 0000000..725f54f --- /dev/null +++ b/lipe/lipe_delete @@ -0,0 +1,120 @@ +#!/bin/bash + +set -e + +LIPE_PATH=${LIPE_PATH:-$(dirname $(type -p $0))} +. $LIPE_PATH/lipe-func.sh + +PROGRAM_NAME=$(basename $0) +LIPE_FIND=${LIPE_FIND:-"lipe_find2"} +DEBUG=false + +usage() { + echo "Usage: $PROGRAM_NAME [OPTION]... --client-mount=CLIENT_MOUNT -- DEVICE EXPRESSION" >&2 + echo "Try '$PROGRAM_NAME --help' for more information" >&2 + exit 1 +} + +help() { +cat <&2 +} + +main "$@" -- 1.8.3.1