Article ID: 118089, created on Oct 21, 2013, last review on May 10, 2014

  • Applies to:
  • H-Sphere

Symptoms

Logrotate config in /hsphere/local/config/httpd/logrotate_confs/ has a zero size and logs don't work.

Cause

Bug. Request id 143736.

Workaround

Add '-p' switch to all mkdir calls in /hsphere/shared/scripts/log-init script (3 cases).

# cat /hsphere/shared/scripts/log-init
#!/bin/sh

#$1 - var dir name (/domain-name.com)
#$2 - username
#$3 - group name
#$4 - subdir name (/logs)

. /hsphere/shared/scripts/default.sh

home_dir=`eval echo ~$2`
username="$2"
usergroup="$3"

isValidIdentifier "$username" || die "Bad username specified"

SUDO_AS_USER="sudo -u $username"

logsdir="$home_dir$4"
logssubdir="$logsdir$1"

old_umask=`umask`
umask 022

# permissions here set by rwx & umask since -m may contain a race itself
mkdir -p "$logsdir"
mkdir -p "$logssubdir"

for dir in "$logsdir" "$logssubdir"; do
        if [ ! -d "$dir" -o ! -O "$dir" ]; then
                die "Can't create $dir: maybe it already exists and owned by $username" 2
        fi
done

# -m kinda safe here because privileges are dropped
$SUDO_AS_USER mkdir -p -m 755 "$home_dir/stats"

if [ ! -d $home_dir/stats ]; then
        die "Tried to create /stats directory, but some non-directory already exists there" 3
fi
umask "$old_umask"
sudo /hsphere/shared/scripts/log-init.pl "$@"

Search Words

Logrotate

Transfer Log

log-init

transferlog

f213b9fa8759d57bee5d547445806fe7 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF