aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/update_apt-panopticon
blob: ebd5e45883ee1b6c9a1b46a28d591751f1939a75 (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
#!/bin/bash

cd /var/www/html/apt-panopticon/apt-panopticon_cgp
if [ -f .git ] ; then
    git pull > /dev/null
    chown -R www-data:www-data *
fi
cd /var/www/html/apt-panopticon/apt-panopticon
if [ -f .git ] ; then
    git pull > /dev/null
    chown -R www-data:www-data *
fi

# Check if the lock file still exists.
if [ -f apt-panopticon.lock ] ; then
    # Check if it's still running.
    ps ax -eo pid,args | grep "luajit ./apt-panopticon.lua" | grep -v "grep luajit ./apt-panopticon.lua" | while read line ; do echo "Previous apt-panopticon still running, exiting." exit 1 ; done
    echo "Crashed apt-panopticon detected, removing stale lock file."
    rm apt-panopticon.lock
fi

rm ../results; ln -s apt-panopticon/results_old ../results
flock -n apt-panopticon.lock ./apt-panopticon.lua && rm apt-panopticon.lock
rm ../results; ln -s apt-panopticon/results ../results

chown -R www-data:www-data *