You can get pretty close to it. First, install somewhere this script I just whipped up. Let's say it's at
/bin/evenodd:
Code:
#!/bin/sh
whichone=$1
shift
second=$(date '+%S' | sed -e 's/^.//')
if echo $second | grep [02468] > /dev/null
then
if [ $whichone = "even" ]
then
"$@"
fi
else
if [ $whichone = "odd" ]
then
"$@"
fi
fi
Then in your crontab file instead of executing this program:
Code:
/usr/bin/whatever the chosen parameters
you execute this program if you want it to run at even-numbered seconds:
Code:
/bin/evenodd even /usr/bin/whatever the chosen parameters
or this program if you want it to run at odd-numbered seconds:
Code:
/bin/evenodd odd /usr/bin/whatever the chosen parameters
Hope this helps.