X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=cron.sh;h=42a2b0502a0094222d18bfecf87d94578fd6b4da;hb=a356ba4a00c5305a8d35b9ed98eeae6d2e0e11a1;hp=dd695e6a06287ff25976db328d0420e6dae71c85;hpb=a3f5f4bf70786172cde2dd59e11fa9cc453046b0;p=APKPM.git diff --git a/cron.sh b/cron.sh index dd695e6..42a2b05 100755 --- a/cron.sh +++ b/cron.sh @@ -1,10 +1,25 @@ -#!/bin/bash -x +#!/bin/bash -running=`echo status | nc -w 1 localhost 4730 | grep ^poll_prefix | cut -d" " -f2` +what=$1 + +if [ "$what" == "install" ] ; then + +cat > /etc/cron.d/apkpm <<__CRON__ +# m h dom mon dow user command +*/15 * * * * dpavlin /srv/APKPM/cron.sh CPE_poll +*/15 * * * * dpavlin /srv/APKPM/cron.sh poll_ZTEDSLAM +*/15 * * * * dpavlin /srv/APKPM/cron.sh poll_ZTEMSAN +__CRON__ + +exit + +fi + +running=`echo status | nc -w 1 localhost 4730 | grep ^$what | cut -d" " -f2` if [ "$running" -gt 0 ] ; then - echo "poll allready queued!" + echo "$what allready queued!" exit 1 fi -time echo | gearman -N -f poll_prefix +time echo | gearman -N -f $what