feat: force attrs for new files
This commit is contained in:
@ -28,9 +28,9 @@ source /etc/steamcmd/steamcmd.conf
|
||||
source /etc/kf2-srv/kf2-srv.conf
|
||||
source /etc/kf2-srv/bot.conf
|
||||
|
||||
ScriptFullname=$(readlink -e "$0")
|
||||
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
|
||||
readonly ScriptVersion="0.12.0"
|
||||
readonly ScriptFullname=$(readlink -e "$0")
|
||||
readonly ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
|
||||
readonly ScriptVersion=$(rpm -qi "$ScriptName" | grep 'Version' | sed -r 's|.+: +||g') # mb problems in other langs ('Version')
|
||||
|
||||
# Constants. Don't change.
|
||||
readonly AppServerNum="232130"
|
||||
|
43
SOURCES/kf2-srv-force-attr
Normal file
43
SOURCES/kf2-srv-force-attr
Normal file
@ -0,0 +1,43 @@
|
||||
#!/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/>.
|
||||
|
||||
declare -A ModeNames MutNames
|
||||
|
||||
source /etc/kf2-srv/kf2-srv.conf
|
||||
|
||||
DirLog="/var/log/kf2-srv"
|
||||
DirLogBeta="/var/log/kf2-srv-beta"
|
||||
DirInstances="/etc/kf2-srv/instances"
|
||||
DirInstancesBeta="/etc/kf2-srv/instances-beta"
|
||||
|
||||
/usr/bin/inotifywait -qmr -e create -e moved_to --format %w%f \
|
||||
"$DirLog" "$DirLogBeta" "$DirInstances" "$DirInstancesBeta" | \
|
||||
while read File
|
||||
do
|
||||
if echo "$File" | grep -Piq "\.log$"; then
|
||||
chmod "$ForceLogPermissions" "$File"
|
||||
chown :"$ForceLogGroup" "$File"
|
||||
elif echo "$File" | grep -Piq "\.ini$"; then
|
||||
chmod "$ForceIniPermissions" "$File"
|
||||
chown :"$ForceIniGroup" "$File"
|
||||
fi
|
||||
done
|
||||
|
@ -5,8 +5,7 @@ Description=kf2-srv force attr service
|
||||
Type=simple
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
EnvironmentFile=/etc/kf2-srv/kf2-srv.conf
|
||||
ExecStart=/bin/bash -c 'declare -A ModeNames MutNames; source /etc/kf2-srv/kf2-srv.conf; /usr/bin/inotifywait -qmr -e create -e moved_to --format %%w%%f /var/log/kf2-srv /var/log/kf2-srv-beta /etc/kf2-srv/instances /etc/kf2-srv/instances-beta | while read File; do if echo "$File" | grep -Piq "\.log$"; then chmod "$ForceLogPermissions" "$File"; chown :"$ForceLogGroup" "$File"; elif echo "$File" | grep -Piq "\.ini$"; then chmod "$ForceIniPermissions" "$File"; chown :"$ForceIniGroup" "$File"; fi; done'
|
||||
ExecStart=/usr/sbin/kf2-srv-force-attr
|
||||
Restart=always
|
||||
|
||||
NoNewPrivileges=yes
|
||||
|
@ -17,7 +17,7 @@ ModeNames['KFGameContent.KFGameInfo_VersusSurvival']='Versus'
|
||||
MutNames['ServerExtMut.ServerExtMut']='RPG'
|
||||
|
||||
# These parameters works only if "kf2-srv-force-attr.service" is active
|
||||
ForceIniPermissions=644
|
||||
ForceIniPermissions=664
|
||||
ForceLogPermissions=640
|
||||
ForceIniGroup=steam
|
||||
ForceLogGroup=steam
|
||||
|
Reference in New Issue
Block a user