What the best way to create a log file in an rpm spec file? The service I'm creating runs under an unprivileged user so cannot create files in /var/log/.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You could create /var/log/myservice/
directory and make it owned by your user.
Inside %install or make install: (ignoring buildroot & such)
install -d /var/log/myservice -o serviceuser -m 750
This assumes you are running your service similarly to apache which often runs as user apache
and still puts logs in var/log/apache
Then add the corresponding rule for /var/log/myservice
in your spec file.
%dir /var/log/myservice