Browse Source

logrotate + search invalid images, используйте gogocron с интервалом проверки 15 секунд, 60 секунд слишком большой интервал

master
Vladimir Smagin 11 months ago
parent
commit
ffe1d7667c
5 changed files with 27 additions and 1 deletions
  1. 4
    1
      .gitignore
  2. 7
    0
      daily-job.sh
  3. 0
    0
      gengal-invalid.list
  4. 9
    0
      gengal.sh
  5. 7
    0
      logrotate_tomsk-sky

+ 4
- 1
.gitignore View File

@@ -1,4 +1,7 @@
datadir
galdir
*.log
*.gz
daily-job.cookies
zabbix_creds
zabbix_creds
jpeginfo

+ 7
- 0
daily-job.sh View File

@@ -3,9 +3,16 @@ cd "$(dirname "$0")"

source zabbix_creds

srcpath="/srv/tomsk-sky.blindage.org/tomsk-sky-archiver"

ts=$(date -u '+%F')

wget --save-cookies=daily-job.cookies -4 --keep-session-cookies -O - -S --post-data="name=${zbxuser}&password=${zbxpass}&enter=Sign in&autologin=1" "${zbxurl}/index.php?login=1"
wget -4 --load-cookies=daily-job.cookies -O datadir/$ts/graph_termo_utc+7.png "${zbxurl}/chart2.php?graphid=1005&from=now-24h&to=now&profileIdx=web.graphs.filter&profileIdx2=1005&width=959&_=tf88n7na&screenid="
wget -4 --load-cookies=daily-job.cookies -O datadir/$ts/graph_pressure_utc+7.png "${zbxurl}/chart2.php?graphid=989&from=now-24h&to=now&profileIdx=web.graphs.filter&profileIdx2=989&width=959&_=tf89xtu8&screenid="

find ./datadir/${ts} -name "*.jpg" -type f -exec ./jpeginfo -c {} \; | grep -E "WARNING|ERROR" | cut -d " " -f 1 > gengal-invalid.list
xargs rm < gengal-invalid.list

docker run -t --rm --name sky-gallery-generator -v $srcpath:/work -u $(id -u):$(id -g) thumbsupgallery/thumbsup sh /work/gengal.sh


+ 0
- 0
gengal-invalid.list View File


+ 9
- 0
gengal.sh View File

@@ -0,0 +1,9 @@
#!/bin/bash
cd "$(dirname "$0")"

echo "Generating image gallery"

thumbsup \
--input /work/datadir --output /work/galdir --theme cards \
--albums-from "{YYYY}/{MMMM YYYY}/{YYYY-MM-DD}" \
--sort-albums-direction desc --sort-media-by filename --sort-media-direction asc

+ 7
- 0
logrotate_tomsk-sky View File

@@ -0,0 +1,7 @@
/srv/tomsk-sky.blindage.org/tomsk-sky-archiver/*.log {
daily
missingok
rotate 7
compress
notifempty
}

Loading…
Cancel
Save