-# While this check can be done in the following case, some assumptions
-# down there are easier if we sorted out calls without an arg before.
-if [[ ${ARG} == meh ]]; then
- cat - <<EOF
+# Check if the argument is a known one. If so, lock us so that only
+# one copy of the type of cronscript runs. The $type.tasks file is
+# mandantory, so use that for locking.
+case ${ARG} in
+ ${POSSIBLEARGS})
+ # Only one of me should ever run.
+ FLOCKER=${FLOCKER:-""}
+ [ "${FLOCKER}" != "${configdir}/${PROGRAM}.tasks" ] && exec env FLOCKER="${configdir}/${PROGRAM}.tasks" flock -E 0 -en "${configdir}/${PROGRAM}.tasks" "$0" "$@" || :
+ ;;
+ *)
+ cat - <<EOF