#!/bin/sh
export THIS_DIR="$(cd "$( dirname "$0" )" && pwd )"

/bin/sh $THIS_DIR/init_env.sh

if [ ! -d /var/log/api/ ];then
    mkdir -p /var/log/api/
fi

chown apache:apache /var/log/api/

# 初始化 api_php_errors.log
touch /var/log/api/api_php_errors.log
chown apache:apache /var/log/api/api_php_errors.log

# 初始化 api_pdo_mysql相關log
touch /var/log/api/api_pdo_mysql.log
chown apache:apache /var/log/api/api_pdo_mysql.log

touch /var/log/api/api_pdo_mysql-debug.log
chown apache:apache /var/log/api/api_pdo_mysql-debug.log

touch /var/log/api/api_pdo_mysql-error.log
chown apache:apache /var/log/api/api_pdo_mysql-error.log

# To recursively give directories read&execute privileges:
find /var/log/api -type d -exec chmod 755 {} +

# To recursively give files read privileges:
find /var/log/api -type f -exec chmod 600 {} +