modify schema for new CPE stats
[APKPM.git] / cron.sh
1 #!/bin/bash
2
3 what=$1
4
5 if [ "$what" == "install" ] ; then
6
7 cat > /etc/cron.d/apkpm <<__CRON__
8 # m h dom mon dow user  command
9 */15 *  * * *   dpavlin /srv/APKPM/cron.sh poll_prefix
10 */15 *  * * *   dpavlin /srv/APKPM/cron.sh poll_ZTEDSLAM
11 */15 *  * * *   dpavlin /srv/APKPM/cron.sh poll_ZTEMSAN
12 __CRON__
13
14 exit
15
16 fi
17
18 running=`echo status | nc -w 1 localhost 4730 | grep ^$what | cut -d"   " -f2`
19 if [ "$running" -gt 0 ] ; then
20         echo "$what allready queued!"
21         exit 1
22 fi
23
24 time echo | gearman -N -f $what
25