Pmlogger directory permissions

"Martins Innus" <[email protected]> Mon, 30 Jan 2017 18:33:13 +0000
Newsgroups gmane.comp.sysutils.pcp
Message-ID <[email protected]>
Hi,
	We have had a long standing problem that I haven’t been able to track down, but now due to a configuration change, I at least think I know what is causing it.

Our pmlogger control file looks like this:


LOCALHOSTNAME	y   n	"/projects/ccr/pcp/pcp-logs/LOCALHOSTNAME/$(date +%Y)/$(date +%m)/$(date +%d)"	-r -c /etc/pcp/pmlogger/pmlogger-config.ubccr


Where "/projects/ccr/pcp/pcp-logs/LOCALHOSTNAME/“ exists and is owned by the pcp user prior to installing pcp on a node.

Machine is Centos 7.

We have found that since going to a new directory per day, once pmlogger is started with the systemd scripts, it never gets restarted by pmlogger_daily to be able to have one directory per day.

I think there are 2 issues combining to cause this problem:

1.  In the default crontab setup, each day pmlogger_daily runs before pmlogger_check.  While they share similar code, only pmlogger_check has the code  to actually create the directory specified in the control file. Not sure if this should be added into the daily file, or if this was left out intentionally.

So I changed the order that these run in, so that pmlogger_check runs first each day, but now get the following from the cron log:


mkdir: cannot create directory '/projects/ccr/pcp/pcp-logs/cpn-d13-03.int.ccr.buffalo.edu/2017/01/30': Permission denied

And looking there:

[pcp@cpn-d13-03 pmlogger]$ ls -l /projects/ccr/pcp/pcp-logs/cpn-d13-03.int.ccr.buffalo.edu/2017/01
drwxr-xr-x 2 pcp pcp 308 Jan 26 23:35 26

BUT:

[pcp@cpn-d13-03 pmlogger]$ ls -l /projects/ccr/pcp/pcp-logs/cpn-d13-03.int.ccr.buffalo.edu/2017/
drwxr-xr-x 3 root root 20 Jan 26 15:43 01

Which leads to:

2.  The systemd/init scripts run as root.  So even though the pmlogger startup script calls pmlogger_check, since it runs as root, the directory tree gets created with root permissions.  There is a single chown to fix the leaf directory.  But the parents are still owned by root.



I believe the reason we are seeing intermittent problems is that I *think* that if you install pcp with the crontab entries present, but only enable the service, but not start it.  The next time cron runs, it uses pmlogger_check run as the pcp user and all the directories get created properly.

Sorry for the convoluted email, but these are my best guesses at the moment, and wanted to see if this made sense to anyone else or if there were thoughts on how to proceed.


Thanks

Martins





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#15049): https://groups.io/g/pcp/message/15049
View All Messages In Topic (1): https://groups.io/g/pcp/topic/4288595
Mute This Topic: https://groups.io/mt/4288595?uid=174580
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
[email protected]
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub?uid=174580
Group Home: https://groups.io/g/pcp
Contact Group Owner: [email protected]
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354243/563757577/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-