File: popularity-contest-ltsp

package info (click to toggle)
ltsp 0.99debian11
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 976 kB
  • ctags: 103
  • sloc: sh: 1,320; python: 485; ansic: 436; lex: 152; makefile: 129; yacc: 58
file content (25 lines) | stat: -rwxr-xr-x 1,018 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# install this in the server's cron.weekly to have the terminal chroot
# filesystems submit popularity-contest data

# it requipres installing popularity-contest in each chroot, preferrably
# configured to use HTTP POST, introduced in popularity-contest 1.30, as this
# avoids the need for working mail in the chroot environment.

# change this if you have chroots in other locations
BASE="/opt/ltsp"

for base in $BASE ; do
    if [ -d "$BASE" ]; then
        # find all the top-level directories in $BASE
        for dir in $(find $BASE -maxdepth 1 -type d) ; do
            # only do the following if popularity-contest is installed, 
            # /bin/true exists and returns true (in case of architecture mis-match),
            # and chroot is available
            if [ -x $dir/etc/cron.weekly/popularity-contest ] && [ -x $dir/bin/true ] && [ $dir/bin/true ] && [ -n "$(which chroot)" ] ; then
                chroot $dir /etc/cron.weekly/popularity-contest
            fi
        done
    fi
done