#!/bin/bash # shall we run ? status=$(/sbin/e-smith/db configuration getprop durep status || echo 'enabled') if [[ "$status" == "disabled" ]]; then exit fi # original folders to be accounted /usr/local/bin/durep -q -x -sf /var/lib/durep/user.ds /home/e-smith/files/users /usr/local/bin/durep -q -x -sf /var/lib/durep/ibays.ds /home/e-smith/files/ibays # known folder from contribs and from base folders=( "/home/e-smith/files/ezmlm" "/home/e-smith/files/shares" "/home/e-smith/db" "/opt/webshare") # user added folder to stat userfolders=$(/sbin/e-smith/db configuration getprop durep folders || echo '') ufolders=(${userfolders//,/ }) folders=("${folders[@]}" "${ufolders[@]}") for folder in "${folders[@]}" do name=` echo ${folder//\//_}` #name=`basename $folder` if [ -d "$folder" ]; then /usr/local/bin/durep -q -x -sf /var/lib/durep/$name.ds $folder else if [ -f "/var/lib/durep/$name.ds" ];then rm /var/lib/durep/$name.ds -f fi fi done # make the stats viewable /usr/local/bin/durep -c /var/lib/durep/ chmod 644 /var/lib/durep/* chown root:admin /etc/e-smith/web/panels/manager/html/durep/*.cgi chmod 750 /etc/e-smith/web/panels/manager/html/durep/*.cgi # remove ds file not renewd for more than 24 hours find /var/lib/durep/ -type f -iname *.ds -mtime +"1" |xargs rm -f