feat(logrotate): fix config with bad user
fixes https://github.com/pterodactyl/panel/issues/3452
This commit is contained in:
parent
31ff3f8b56
commit
7a24e976ef
|
@ -122,11 +122,6 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
|
||||||
log.WithField("error", err).Fatal("failed to configure system directories for pterodactyl")
|
log.WithField("error", err).Fatal("failed to configure system directories for pterodactyl")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := config.EnableLogRotation(); err != nil {
|
|
||||||
log.WithField("error", err).Fatal("failed to configure log rotation on the system")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.WithField("username", config.Get().System.User).Info("checking for pterodactyl system user")
|
log.WithField("username", config.Get().System.User).Info("checking for pterodactyl system user")
|
||||||
if err := config.EnsurePterodactylUser(); err != nil {
|
if err := config.EnsurePterodactylUser(); err != nil {
|
||||||
log.WithField("error", err).Fatal("failed to create pterodactyl system user")
|
log.WithField("error", err).Fatal("failed to create pterodactyl system user")
|
||||||
|
@ -136,6 +131,10 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
|
||||||
"uid": config.Get().System.User.Uid,
|
"uid": config.Get().System.User.Uid,
|
||||||
"gid": config.Get().System.User.Gid,
|
"gid": config.Get().System.User.Gid,
|
||||||
}).Info("configured system user successfully")
|
}).Info("configured system user successfully")
|
||||||
|
if err := config.EnableLogRotation(); err != nil {
|
||||||
|
log.WithField("error", err).Fatal("failed to configure log rotation on the system")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pclient := remote.New(
|
pclient := remote.New(
|
||||||
config.Get().PanelLocation,
|
config.Get().PanelLocation,
|
||||||
|
|
|
@ -538,8 +538,7 @@ func EnableLogRotation() error {
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
t, err := template.New("logrotate").Parse(`
|
t, err := template.New("logrotate").Parse(`{{.LogDirectory}}/wings.log {
|
||||||
{{.LogDirectory}}/wings.log {
|
|
||||||
size 10M
|
size 10M
|
||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
|
@ -547,9 +546,8 @@ func EnableLogRotation() error {
|
||||||
maxage 7
|
maxage 7
|
||||||
missingok
|
missingok
|
||||||
notifempty
|
notifempty
|
||||||
create 0640 {{.User.Uid}} {{.User.Gid}}
|
|
||||||
postrotate
|
postrotate
|
||||||
killall -SIGHUP wings
|
/usr/bin/systemctl kill -s HUP wings.service >/dev/null 2>&1 || true
|
||||||
endscript
|
endscript
|
||||||
}`)
|
}`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user