Commit f0754f8f authored by Volodymyr Melnyk's avatar Volodymyr Melnyk

This is finest (or so I believe).

parent 1fe35017
......@@ -6,22 +6,22 @@ PATH=/bin
systemd_service_config='/etc/systemd/system/save_io_stats.service'
if [[ ! -f "${systemd_service_config}" ]]; then
log "Installing systemd service configuration file"
_log 1 "Installing systemd service configuration file"
cat "${_share_dir}/systemd/save_io_stats.service" >"${systemd_service_config}"
fi
sudoers_config='/etc/sudoers.d/save_io_stats'
if [[ ! -f "${sudoers_config}" ]]; then
log "Installing sudoers configuration file"
_log 1 "Installing sudoers configuration file"
cat "${_share_dir}/sudoers/save_io_stats" >"${sudoers_config}"
fi
io_stats_spool="${_spool_dir}/io"
if [[ ! -f "${io_stats_spool}" ]]; then
log "Creating the spool directory"
_log 1 "Creating the spool directory"
mkdir -p "${io_stats_spool}"
chown root:nobody "${io_stats_spool}"
chmod 0770 "${io_stats_spool}"
fi
log "Installation steps have been completed"
_log 1 "Installation steps have been completed"
......@@ -9,3 +9,32 @@ _lock_dir="${_var_dir}/run"
_spool_dir="${_var_dir}/spool"
_share_dir="${_root_dir}/share"
_mib_root=".1.3.6.1.4.1.53033.100"
trap "exit ${_exit_status_error}" TERM
_top_pid="${$}"
function _log {
local _output
case "${1}" in
1)
exec 3>&1
;;
2)
exec 3>&2
;;
*)
exec 3>/dev/null
;;
esac
shift
echo "[$(date +%F\ %T)]" $* | tee -a "${_log_file}" >&3
}
function _warn {
_log 2 "[!]" $*
}
function _die {
_warn $*
kill -s TERM "${_top_pid}"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment