/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to scripts/system/cacher.sh

  • Committer: Suren A. Chilingaryan
  • Date: 2018-02-24 23:58:02 UTC
  • Revision ID: csa@suren.me-20180224235802-7gg56s3ocrpjf7lw
Fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
ADEI_PATH=${ADEI_PATH:-/srv/www/htdocs/adei}
21
21
ADEI_URL=${ADEI_URL:-http://localhost/adei}
22
22
ADEI_PARALLEL=${ADEI_PARALLEL:-sources}
23
 
ADEI_IDLE_SLEEP=${ADEI_IDLE_SLEEP:-0.5}
 
23
ADEI_IDLE_SLEEP=${ADEI_IDLE_SLEEP:-5}
24
24
 
25
25
setup_arg=""
26
26
[ -n "$ADEI_SETUP" ] && setup_arg="setup=${ADEI_SETUP}&"
34
34
 
35
35
while [ $run -eq 1 ]; do
36
36
    src=$(curl $ADEI_SCHEDULER_URL 2>/dev/null)
 
37
    date=$(date -Iseconds)
37
38
    if [[ "$src" =~ ^Error ]]; then
38
 
        echo "Error querying scheduler service at $ADEI_SCHEDULER_URL"
 
39
        echo "$date Error querying scheduler service at $ADEI_SCHEDULER_URL"
39
40
        echo $src
40
41
    elif [ -n "$src" ]; then
41
42
        [[ $src =~ ^([^ ]*)\ (.*)$ ]]
47
48
            flock -nx 10
48
49
            if [ $? -eq 0 ]; then
49
50
                args="$args -multihost -parallel ${ADEI_PARALLEL}"
50
 
                echo "Caching \"$name\" with arguments: $args"
 
51
                echo "$date Caching \"$name\" with arguments: $args"
51
52
                php "$ADEI_PATH/system/cache.php" $args
52
53
            else
53
 
                echo "Skipping \"$name\" which is processed by another cacher"
 
54
                echo "$date Skipping \"$name\" which is processed by another cacher"
54
55
            fi
55
56
        ) 10> $lock
56
57
    elif [ $run -eq 1 ]; then
57
 
        echo "Idling..."
 
58
        echo "$date Idling..."
58
59
        sleep "$ADEI_IDLE_SLEEP"
59
60
    fi
60
61
done