summaryrefslogtreecommitdiff
path: root/community-testing/cronie/run-cron
blob: 5c62e3377045dc9b6bd97681d92e7b06b560aeab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

# run-parts - concept taken from Debian

# keep going when something fails
set +e

if [ $# -lt 1 ]; then
	echo "Usage: run-parts <dir>"
	exit 1
fi

if [ ! -d $1 ]; then
	echo "Not a directory: $1"
	exit 1
fi

# Ignore *~ and *, scripts
for i in $1/*[^~,] ; do
	[ -d $i ] && continue
	# Don't run *.{pacsave,pacorig,pacnew,swp} scripts
	[ "${i%.pacsave}" != "${i}" ] && continue
        [ "${i%.pacorig}" != "${i}" ] && continue
        [ "${i%.pacnew}" != "${i}" ] && continue
        [ "${i%.swp}" != "${i}" ] && continue
	[ "${i%,v}" != "${i}" ] && continue

	if [ -x $i ]; then
		$i 2>&1 | awk -v "progname=$i" \
			      'progname {
				   print progname ":\n"
				   progname="";
			       }
			       { print; }'
	fi
done

exit 0