blob: 1d3e51a51e39e8b59e3d5c5cf63f3b699176f7e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/bin/bash
CHECK=$(redis-cli ping)
[ "$CHECK" = "PONG" ] || exit 1
# ARCH detection and check
if [ "$(uname -m)" = "x86_64" ]; then
SUF=x
QUEUE=mockx
else
SUF=a
QUEUE=mocka
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then
echo "Usage $0 [ option ]"
echo " -e --erase to empty the queue"
echo " -l --list to list the queue"
echo " -p --perm to run permanently"
exit 0
elif [ "$1" = "-l" -o "$1" = "--list" ]; then
redis-cli smembers $QUEUE
exit 0
elif [ "$1" = "-e" -o "$1" = "--erase" ]; then
redis-cli del $QUEUE
exit 0
fi
while true
do
CMD=$(redis-cli spop $QUEUE)
if [ -z "$CMD" ]; then
if [ "$1" = "-p" -o "$1" = "--perm" ]; then
echo -n .
sleep 1
continue
else
break
fi
fi
TXT="$(echo $CMD | sed -e 's/^.*-r //;s/ .*$//') "
RPM="$(echo $CMD | sed -e 's:\.rpm.*$:.rpm:;s:^.*/::')"
echo -en "\r$(date +%X) $RPM ${TXT:0:10}"
$CMD --uniqueext=$PPID && echo " Ok." || echo " Error !"
done
echo "$(date +%X) Done"
|