feat: log cmd group
This commit is contained in:
parent
9865447789
commit
8f34f6fa95
@ -196,6 +196,8 @@ test: fake-systemd-build
|
|||||||
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/workshop/add
|
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/workshop/add
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/workshop/delete
|
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/workshop/delete
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/workshop/sync
|
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/workshop/sync
|
||||||
|
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/log/cat
|
||||||
|
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/log/tail
|
||||||
|
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/lib/ban.lib
|
$(BASHCHECK) $(RELEASEDIR)/main/lib/ban.lib
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/lib/game.lib
|
$(BASHCHECK) $(RELEASEDIR)/main/lib/game.lib
|
||||||
@ -205,6 +207,7 @@ test: fake-systemd-build
|
|||||||
$(BASHCHECK) $(RELEASEDIR)/main/lib/playerids.lib
|
$(BASHCHECK) $(RELEASEDIR)/main/lib/playerids.lib
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/lib/webadmin.lib
|
$(BASHCHECK) $(RELEASEDIR)/main/lib/webadmin.lib
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/lib/workshop.lib
|
$(BASHCHECK) $(RELEASEDIR)/main/lib/workshop.lib
|
||||||
|
$(BASHCHECK) $(RELEASEDIR)/main/lib/log.lib
|
||||||
|
|
||||||
$(BASHCHECK) $(RELEASEDIR)/main/bash_completion/$(NAME)
|
$(BASHCHECK) $(RELEASEDIR)/main/bash_completion/$(NAME)
|
||||||
|
|
||||||
|
47
SOURCES/main/cmdgrp/log/cat
Normal file
47
SOURCES/main/cmdgrp/log/cat
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# kf2-srv is a command line tool for managing a set of Killing Floor 2 servers.
|
||||||
|
# Copyright (C) 2019, 2020 GenZmeY
|
||||||
|
# mailto: genzmey@gmail.com
|
||||||
|
#
|
||||||
|
# This file is part of kf2-srv.
|
||||||
|
#
|
||||||
|
# kf2-srv is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
cmd_need_superuser () { false ;}
|
||||||
|
cmd_need_steamuser () { false ;}
|
||||||
|
cmd_need_installed_server () { true ;}
|
||||||
|
|
||||||
|
function cmd_usage ()
|
||||||
|
{
|
||||||
|
echo "[<instance>...]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_info ()
|
||||||
|
{
|
||||||
|
echo "Print in stdout full log of specified server instance(s)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_help ()
|
||||||
|
{
|
||||||
|
echo "TODO: description"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_main ()
|
||||||
|
{
|
||||||
|
include "$LibDir/log.lib"
|
||||||
|
|
||||||
|
log_cat "$@"
|
||||||
|
}
|
||||||
|
|
47
SOURCES/main/cmdgrp/log/tail
Normal file
47
SOURCES/main/cmdgrp/log/tail
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# kf2-srv is a command line tool for managing a set of Killing Floor 2 servers.
|
||||||
|
# Copyright (C) 2019, 2020 GenZmeY
|
||||||
|
# mailto: genzmey@gmail.com
|
||||||
|
#
|
||||||
|
# This file is part of kf2-srv.
|
||||||
|
#
|
||||||
|
# kf2-srv is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
cmd_need_superuser () { false ;}
|
||||||
|
cmd_need_steamuser () { false ;}
|
||||||
|
cmd_need_installed_server () { true ;}
|
||||||
|
|
||||||
|
function cmd_usage ()
|
||||||
|
{
|
||||||
|
echo "[<instance>...]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_info ()
|
||||||
|
{
|
||||||
|
echo "Print in stdout tail log of specified server instance(s) in real time"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_help ()
|
||||||
|
{
|
||||||
|
echo "TODO: description"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_main ()
|
||||||
|
{
|
||||||
|
include "$LibDir/log.lib"
|
||||||
|
|
||||||
|
log_tail "$@"
|
||||||
|
}
|
||||||
|
|
75
SOURCES/main/lib/log.lib
Normal file
75
SOURCES/main/lib/log.lib
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# kf2-srv is a command line tool for managing a set of Killing Floor 2 servers.
|
||||||
|
# Copyright (C) 2019, 2020 GenZmeY
|
||||||
|
# mailto: genzmey@gmail.com
|
||||||
|
#
|
||||||
|
# This file is part of kf2-srv.
|
||||||
|
#
|
||||||
|
# kf2-srv is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
function log_cat () # $*: InstanceName[s]
|
||||||
|
{
|
||||||
|
include "$LibDir/instance.lib"
|
||||||
|
|
||||||
|
local InstanceList="$*"
|
||||||
|
if [[ -z "$InstanceList" ]] ; then
|
||||||
|
InstanceList=$(show_instances)
|
||||||
|
fi
|
||||||
|
|
||||||
|
local Logs
|
||||||
|
for Instance in $InstanceList
|
||||||
|
do
|
||||||
|
if instance_exists "$Instance"; then
|
||||||
|
local Service=$(service_name "$Instance")
|
||||||
|
Logs+="-u $Service "
|
||||||
|
else
|
||||||
|
echo "Instance $Instance not exitst"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$Logs" ]]; then
|
||||||
|
echo "No logs available."
|
||||||
|
else
|
||||||
|
journalctl --no-pager $Logs
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function log_tail () # $*: InstanceName[s]
|
||||||
|
{
|
||||||
|
include "$LibDir/instance.lib"
|
||||||
|
|
||||||
|
local InstanceList="$*"
|
||||||
|
if [[ -z "$InstanceList" ]] ; then
|
||||||
|
InstanceList=$(show_instances)
|
||||||
|
fi
|
||||||
|
|
||||||
|
local Logs
|
||||||
|
for Instance in $InstanceList
|
||||||
|
do
|
||||||
|
if instance_exists "$Instance"; then
|
||||||
|
local Service=$(service_name "$Instance")
|
||||||
|
Logs+="-u $Service "
|
||||||
|
else
|
||||||
|
echo "Instance $Instance not exitst"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$Logs" ]]; then
|
||||||
|
echo "No logs available."
|
||||||
|
else
|
||||||
|
echo "Hint: use Ctrl+C to stop output"
|
||||||
|
journalctl --no-pager -f $Logs
|
||||||
|
fi
|
||||||
|
}
|
@ -2,9 +2,12 @@ global(parser.permitSlashInProgramName="on")
|
|||||||
|
|
||||||
template(name="DynFile" type="string" string="/var/log/%programname%.log")
|
template(name="DynFile" type="string" string="/var/log/%programname%.log")
|
||||||
|
|
||||||
|
# Change "UMask" in /usr/lib/systemd/system/rsyslog.service
|
||||||
|
# to make "FileCreateMode" and "Umask" work correctly for this config.
|
||||||
|
|
||||||
if ($programname startswith "kf2-srv") then
|
if ($programname startswith "kf2-srv") then
|
||||||
{
|
{
|
||||||
action(Type="omfile" DynaFile="DynFile" FileCreateMode="0640" Umask="0027" FileOwner="root" FileGroup="steam")
|
action(Type="omfile" DynaFile="DynFile" FileCreateMode="0644" Umask="0022" FileOwner="root" FileGroup="steam")
|
||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%global steamuser steam
|
%global steamuser steam
|
||||||
|
|
||||||
Name: kf2-srv
|
Name: kf2-srv
|
||||||
Version: 0.15.4
|
Version: 0.15.8
|
||||||
Release: 1%{dist}
|
Release: 1%{dist}
|
||||||
Summary: Killing Floor 2 server
|
Summary: Killing Floor 2 server
|
||||||
Group: Amusements/Games
|
Group: Amusements/Games
|
||||||
@ -101,6 +101,9 @@ if [[ $1 == 1 ]]; then # Install
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 8 2020 GenZmeY <genzmey@gmail.com> - 0.16.0-1
|
||||||
|
- log cmg group.
|
||||||
|
|
||||||
* Sat Aug 15 2020 GenZmeY <genzmey@gmail.com> - 0.15.4-1
|
* Sat Aug 15 2020 GenZmeY <genzmey@gmail.com> - 0.15.4-1
|
||||||
- fixed broken update;
|
- fixed broken update;
|
||||||
- replaced steamID3/steamID64 conversation algorithm.
|
- replaced steamID3/steamID64 conversation algorithm.
|
||||||
|
Loading…
Reference in New Issue
Block a user