Create log file when installing rpm

∥☆過路亽.° 提交于 2019-12-10 23:04:39

问题


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


来源:https://stackoverflow.com/questions/22291130/create-log-file-when-installing-rpm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!