diff --git a/run-parts b/run-parts
index 6ab6f11..6b047a4 100755
--- a/run-parts
+++ b/run-parts
@@ -5,10 +5,28 @@
set +e
if [ $# -lt 1 ]; then
- echo "Usage: run-parts
"
+ echo "Usage: run-parts [--list] "
exit 1
fi
+while [ $# -gt 1 ]; do
+ case $1 in
+ --list)
+ list=1
+ shift
+ ;;
+ --)
+ # -- end of options
+ shift
+ break
+ ;;
+ *)
+ # directory
+ break
+ ;;
+ esac
+done
+
if [ ! -d $1 ]; then
echo "Not a directory: $1"
exit 1
@@ -39,14 +57,19 @@ for i in $(LC_ALL=C; echo $1/*[^~,]) ; do
if [ -r $1/whitelist ]; then
grep -q "^$(basename $i)$" $1/whitelist && continue
fi
- logger -p cron.notice -t "run-parts($1)[$$]" "starting $(basename $i)"
- $i 2>&1 | awk -v "progname=$i" \
+ # list executable files in directory
+ if [ ${list:-0} != 0 ]; then
+ echo $i;
+ else # run executable files
+ logger -p cron.notice -t "run-parts($1)[$$]" "starting $(basename $i)"
+ $i 2>&1 | awk -v "progname=$i" \
'progname {
print progname ":\n"
progname="";
}
{ print; }'
- logger -i -p cron.notice -t "run-parts($1)" "finished $(basename $i)"
+ logger -i -p cron.notice -t "run-parts($1)" "finished $(basename $i)"
+ fi
fi
done