![]() |
# which run-parts
/usr/bin/run-partsAnd here's what it looks like before it's all discected in the piece by Jim Sack below. This is a good example of a shell script. Though the topic of shell scripts is beyond the purposes of this book, it does help illuminate how crontab is set up on a Red Hat Linux system, and give you a quick view of a shell script. If you are running a Red Hat system, you can view the file on your own system.
# cat /usr/bin/run-parts
#!/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
for i in $1/* ; do
[ -d $i ] && continue
if [ -x $i ]; then
$i
fi
done
exit 0