summaryrefslogtreecommitdiff
path: root/system/cronie/run-parts
diff options
context:
space:
mode:
authorChris Abela <kristofru@gmail.com>2013-10-27 01:12:37 -0500
committerRobby Workman <rworkman@slackbuilds.org>2013-10-27 23:39:00 -0500
commit12cd740b634feae442197491f27e04852bf1f9ff (patch)
treef0f55c5d16bb8588424b66bbeaeeaf9447d788c3 /system/cronie/run-parts
parente8f1239b6fa1b68cc41edd704c89eade3b86dbd1 (diff)
downloadslackbuilds-12cd740b634feae442197491f27e04852bf1f9ff.tar.gz
system/cronie: Updated for version 1.4.11.
- gunzipping of various support files by rworkman Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/cronie/run-parts')
-rw-r--r--system/cronie/run-parts46
1 files changed, 46 insertions, 0 deletions
diff --git a/system/cronie/run-parts b/system/cronie/run-parts
new file mode 100644
index 0000000000..65c778f36d
--- /dev/null
+++ b/system/cronie/run-parts
@@ -0,0 +1,46 @@
+#!/bin/sh
+# run-parts: Runs all the scripts found in a directory.
+
+# keep going when something fails
+set +e
+
+if [ $# -lt 1 ]; then
+ echo "Usage: run-parts <directory>"
+ exit 1
+fi
+
+if [ ! -d $1 ]; then
+ echo "Not a directory: $1"
+ echo "Usage: run-parts <directory>"
+ exit 1
+fi
+
+# There are several types of files that we would like to
+# ignore automatically, as they are likely to be backups
+# of other scripts:
+IGNORE_SUFFIXES="~ ^ , .bak .new .rpmsave .rpmorig .rpmnew .swp"
+
+# Main loop:
+for SCRIPT in $1/* ; do
+ # If this is not a regular file, skip it:
+ if [ ! -f $SCRIPT ]; then
+ continue
+ fi
+ # Determine if this file should be skipped by suffix:
+ SKIP=false
+ for SUFFIX in $IGNORE_SUFFIXES ; do
+ if [ ! "$(basename $SCRIPT $SUFFIX)" = "$(basename $SCRIPT)" ]; then
+ SKIP=true
+ break
+ fi
+ done
+ if [ "$SKIP" = "true" ]; then
+ continue
+ fi
+ # If we've made it this far, then run the script if it's executable:
+ if [ -x $SCRIPT ]; then
+ $SCRIPT || echo "$SCRIPT failed."
+ fi
+done
+
+exit 0