Fix log rotation error due to missing templates dir in compiled build
This commit is contained in:
		
							parent
							
								
									6ba1b75696
								
							
						
					
					
						commit
						815539b3da
					
				| 
						 | 
					@ -135,7 +135,21 @@ func (sc *SystemConfiguration) EnableLogRotation() error {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defer f.Close()
 | 
						defer f.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t, err := template.ParseFiles("templates/logrotate.tpl")
 | 
						t, err := template.New("logrotate").Parse(`
 | 
				
			||||||
 | 
					{{.LogDirectory}}/wings.log {
 | 
				
			||||||
 | 
					    size 10M
 | 
				
			||||||
 | 
					    compress
 | 
				
			||||||
 | 
					    delaycompress
 | 
				
			||||||
 | 
					    dateext
 | 
				
			||||||
 | 
					    maxage 7
 | 
				
			||||||
 | 
					    missingok
 | 
				
			||||||
 | 
					    notifempty
 | 
				
			||||||
 | 
					    create 0640 {{.User.Uid}} {{.User.Gid}}
 | 
				
			||||||
 | 
					    postrotate
 | 
				
			||||||
 | 
					        killall -SIGHUP wings
 | 
				
			||||||
 | 
					    endscript
 | 
				
			||||||
 | 
					}`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return errors.WithStack(err)
 | 
							return errors.WithStack(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +0,0 @@
 | 
				
			||||||
{{.LogDirectory}}/wings.log {
 | 
					 | 
				
			||||||
    size 10M
 | 
					 | 
				
			||||||
    compress
 | 
					 | 
				
			||||||
    delaycompress
 | 
					 | 
				
			||||||
    dateext
 | 
					 | 
				
			||||||
    maxage 7
 | 
					 | 
				
			||||||
    missingok
 | 
					 | 
				
			||||||
    notifempty
 | 
					 | 
				
			||||||
    create 0640 {{.User.Uid}} {{.User.Gid}}
 | 
					 | 
				
			||||||
    postrotate
 | 
					 | 
				
			||||||
        killall -SIGHUP wings
 | 
					 | 
				
			||||||
    endscript
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user