# Solves Laravel log file permission problem
# author: umurkaragoz
# version: 1.0

DATE=$(date +%Y-%m-%d)
FILE_PATH=/var/www/rest/storage/logs/laravel-"$DATE".log

echo "Will process log file: '$FILE_PATH'"

if [ ! -f "$FILE_PATH" ]; then
  echo "log file does not exists, creating it now"
  touch "$FILE_PATH"
fi

echo "setting the correct permissions on the log file"
chmod 777 "$FILE_PATH"
