fix log file permissions on OpenBSD
This commit is contained in:
parent
0cde3681a6
commit
d3ffbc8225
|
@ -15,11 +15,6 @@ test -f /etc/evomaintenance.cf && . /etc/evomaintenance.cf
|
|||
|
||||
PATH=${PATH}:/usr/sbin
|
||||
|
||||
# log file
|
||||
LOGFILE=${LOGFILE:-/var/log/evomaintenance.log}
|
||||
touch "${LOGFILE}"
|
||||
chown root:adm "${LOGFILE}"
|
||||
|
||||
# get ipaddress
|
||||
|
||||
BEGIN_YEAR=$(date "+%Y")
|
||||
|
@ -30,15 +25,22 @@ if [ "${SYSTEME}" = "Linux" ]; then
|
|||
IP=$(LC_ALL=C who | grep $(ps -o tty= | tail -1) | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
||||
BEGIN_DATE=$(LC_ALL=C who | grep $(ps -o tty= | tail -1) | tr -s ' ' | cut -d" " -f3,4,5)
|
||||
_USER=${SUDO_USER}
|
||||
LOGFILE_PERMS="root:adm"
|
||||
elif [ "${SYSTEME}" = "OpenBSD" ]; then
|
||||
IP=$(LC_ALL=C who | grep $(env | grep SSH_TTY | cut -d"/" -f3) | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
||||
BEGIN_DATE=$(LC_ALL=C who | grep $(env | grep SSH_TTY | cut -d"/" -f3) | tr -s ' ' | cut -d" " -f3,4,5)
|
||||
_USER=${USER}
|
||||
LOGFILE_PERMS="root:wheel"
|
||||
else
|
||||
echo "OS not detected!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# log file
|
||||
LOGFILE=${LOGFILE:-/var/log/evomaintenance.log}
|
||||
touch "${LOGFILE}"
|
||||
chown "${LOGFILE_PERMS}" "${LOGFILE}"
|
||||
|
||||
# end_date
|
||||
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
|
|
Loading…
Reference in a new issue