--- run-crons.stock 2014-11-24 16:45:17.822842446 +0100 +++ run-crons.n 2014-11-24 19:29:08.749535181 +0100 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # $Header: /var/cvsroot/gentoo-x86/sys-process/cronbase/files/run-crons-0.3.3,v 1.1 2009/04/14 06:13:36 bangert Exp $ # @@ -37,7 +37,8 @@ # Make sure we're not running multiple instances at once. # Try twice to lock, otherwise give up. -for ((i = 0; i < 2; i = i + 1)); do +i=0 +while [ "$i" -lt 2 ]; do ln -sn $$ ${LOCKFILE} 2>/dev/null && break # lock failed, check for a running process. @@ -54,6 +55,7 @@ else rm -f ${LOCKFILE} fi + i=$(($i+1)) done # Check to make sure locking was successful