Commit 000bb297 authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv log: run without follow (-f) by default

parent ce10c02a
...@@ -207,7 +207,7 @@ check_command() ...@@ -207,7 +207,7 @@ check_command()
serv_cmd=print serv_cmd=print
withoutservicename=1 withoutservicename=1
;; ;;
log|journal) # HELPCMD: print log for the service log|journal) # HELPCMD: print log for the service (-f - follow, -r - reverse order)
serv_cmd=log serv_cmd=log
;; ;;
edit) edit)
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2016 Etersoft # Copyright (C) 2016, 2020 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2016, 2020 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -20,19 +20,21 @@ ...@@ -20,19 +20,21 @@
__serv_log_altlinux() __serv_log_altlinux()
{ {
local SERVICE="$1" local SERVICE="$1"
local PRG="less"
[ "$2" = "-f" ] && PRG="tail -f"
case "$SERVICE" in case "$SERVICE" in
postfix) postfix)
sudocmd tail -f /var/log/mail/all /var/log/mail/errors sudocmd $PRG /var/log/mail/all /var/log/mail/errors
;; ;;
sshd) sshd)
sudocmd tail -f /var/log/auth/all sudocmd $PRG /var/log/auth/all
;; ;;
cups) cups)
sudocmd tail -f /var/log/cups/access_log /var/log/cups/error_log sudocmd $PRG /var/log/cups/access_log /var/log/cups/error_log
;; ;;
fail2ban) fail2ban)
sudocmd tail -f /var/log/$SERVICE.log sudocmd $PRG /var/log/$SERVICE.log
;; ;;
*) *)
fatal "Have no suitable for $SERVICE service" fatal "Have no suitable for $SERVICE service"
...@@ -47,12 +49,13 @@ serv_log() ...@@ -47,12 +49,13 @@ serv_log()
case $SERVICETYPE in case $SERVICETYPE in
systemd) systemd)
sudocmd journalctl -f -b -u "$SERVICE" "$@" sudocmd journalctl -b -u "$SERVICE" "$@"
;; ;;
*) *)
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__serv_log_altlinux "$SERVICE" FF="" ; [ "$1" = "-f" ] && FF="-f"
__serv_log_altlinux "$SERVICE" $FF
return ;; return ;;
*) *)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE" fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
......
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