refactor: substitute ~/klipper_logs
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -206,7 +206,7 @@ function remove_fluidd_logs(){
|
||||
|
||||
function remove_fluidd_log_symlinks(){
|
||||
local files
|
||||
files=$(find "${HOME}/klipper_logs" -name "fluidd*")
|
||||
files=$(find "${KLIPPER_LOGS}" -name "fluidd*")
|
||||
if [ -n "${files}" ]; then
|
||||
for file in ${files}; do
|
||||
status_msg "Removing ${file} ..."
|
||||
|
||||
@@ -211,7 +211,7 @@ function remove_mainsail_logs(){
|
||||
|
||||
function remove_mainsail_log_symlinks(){
|
||||
local files
|
||||
files=$(find "${HOME}/klipper_logs" -name "mainsail*")
|
||||
files=$(find "${KLIPPER_LOGS}" -name "mainsail*")
|
||||
if [ -n "${files}" ]; then
|
||||
for file in ${files}; do
|
||||
status_msg "Removing ${file} ..."
|
||||
|
||||
@@ -94,9 +94,9 @@ EOT
|
||||
fi
|
||||
|
||||
### step 6.1: create webcamd.log symlink
|
||||
[ ! -d "${HOME}/klipper_logs" ] && mkdir -p "${HOME}/klipper_logs"
|
||||
if [ -f "/var/log/webcamd.log" ] && [ ! -L "${HOME}/klipper_logs/webcamd.log" ]; then
|
||||
ln -s "/var/log/webcamd.log" "${HOME}/klipper_logs/webcamd.log"
|
||||
[ ! -d "${KLIPPER_LOGS}" ] && mkdir -p "${KLIPPER_LOGS}"
|
||||
if [ -f "/var/log/webcamd.log" ] && [ ! -L "${KLIPPER_LOGS}/webcamd.log" ]; then
|
||||
ln -s "/var/log/webcamd.log" "${KLIPPER_LOGS}/webcamd.log"
|
||||
fi
|
||||
|
||||
### step 6.2: add webcamd.log logrotate
|
||||
@@ -175,7 +175,7 @@ function remove_mjpg-streamer(){
|
||||
|
||||
### remove webcamd log and symlink
|
||||
[ -f "/var/log/webcamd.log" ] && sudo rm -f "/var/log/webcamd.log"
|
||||
[ -L "${HOME}/klipper_logs/webcamd.log" ] && rm -f "${HOME}/klipper_logs/webcamd.log"
|
||||
[ -L "${KLIPPER_LOGS}/webcamd.log" ] && rm -f "${KLIPPER_LOGS}/webcamd.log"
|
||||
|
||||
print_confirm "MJPG-Streamer successfully removed!"
|
||||
}
|
||||
@@ -315,7 +315,7 @@ function remove_telegram_bot_env() {
|
||||
|
||||
function remove_telegram_bot_logs() {
|
||||
local files
|
||||
files=$(find "${KLIPPER_LOGS}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/telegram(-[0-9a-zA-Z]+)?\.log(.*)?" | sort)
|
||||
files=$(find "${KLIPPER_LOGS}" -maxdepth 1 -regextype posix-extended -regex "${KLIPPER_LOGS}/telegram(-[0-9a-zA-Z]+)?\.log(.*)?" | sort)
|
||||
|
||||
if [[ -n ${files} ]]; then
|
||||
for file in ${files}; do
|
||||
|
||||
@@ -271,7 +271,7 @@ function create_moonraker_service(){
|
||||
i=""
|
||||
cfg_dir="${KLIPPER_CONFIG}"
|
||||
cfg="${cfg_dir}/moonraker.conf"
|
||||
log="${HOME}/klipper_logs/moonraker.log"
|
||||
log="${KLIPPER_LOGS}/moonraker.log"
|
||||
service="${SYSTEMD}/moonraker.service"
|
||||
### write single instance service
|
||||
write_moonraker_service "" "${cfg}" "${log}" "${service}"
|
||||
@@ -289,7 +289,7 @@ function create_moonraker_service(){
|
||||
fi
|
||||
|
||||
cfg="${cfg_dir}/moonraker.conf"
|
||||
log="${HOME}/klipper_logs/moonraker-${names[${j}]}.log"
|
||||
log="${KLIPPER_LOGS}/moonraker-${names[${j}]}.log"
|
||||
service="${SYSTEMD}/moonraker-${names[${j}]}.service"
|
||||
### write multi instance service
|
||||
write_moonraker_service "${names[${j}]}" "${cfg}" "${log}" "${service}"
|
||||
@@ -392,7 +392,7 @@ function remove_moonraker_systemd() {
|
||||
|
||||
function remove_moonraker_logs() {
|
||||
local files
|
||||
files=$(find "${HOME}/klipper_logs" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/moonraker(-[0-9a-zA-Z]+)?\.log(.*)?" | sort)
|
||||
files=$(find "${KLIPPER_LOGS}" -maxdepth 1 -regextype posix-extended -regex "${KLIPPER_LOGS}/moonraker(-[0-9a-zA-Z]+)?\.log(.*)?" | sort)
|
||||
|
||||
if [[ -n ${files} ]]; then
|
||||
for file in ${files}; do
|
||||
|
||||
@@ -61,7 +61,7 @@ function set_upstream_nginx_cfg(){
|
||||
}
|
||||
|
||||
function symlink_webui_nginx_log(){
|
||||
local interface=${1} path="${HOME}/klipper_logs"
|
||||
local interface=${1} path="${KLIPPER_LOGS}"
|
||||
local access_log="/var/log/nginx/${interface}-access.log"
|
||||
local error_log="/var/log/nginx/${interface}-error.log"
|
||||
[ ! -d "${path}" ] && mkdir -p "${path}"
|
||||
|
||||
@@ -51,7 +51,7 @@ function upload_selection(){
|
||||
[ "${upload_agreed}" = "false" ] && accept_upload_conditions
|
||||
|
||||
local logfiles
|
||||
local klipper_logs="${HOME}/klipper_logs"
|
||||
local klipper_logs="${KLIPPER_LOGS}"
|
||||
local webif_logs="/var/log/nginx"
|
||||
|
||||
function find_logfile(){
|
||||
|
||||
Reference in New Issue
Block a user