Print

Print


In the logrotate script of xrootd, one can find the following postrotate script :

/var/log/xrootd/*/*.log /var/log/xrootd/*.log
...
  postrotate
     PIPE="`dirname $1`/.`basename $1`"
     if [ -p $PIPE ]; then
       /usr/bin/expect -c "set timeout 2; spawn /bin/sh -c \"echo ping > $PIPE\"; expect timeout { exit 1 } eof { exi    t 0 }" > /dev/null;
     fi
  endscript

This has 2 flows.
The first one explains the title : in case you have an xrootd crash (or stop) in between the 'if [-p...]' check and the 'echo ping > $PIPE' statement, you will actually create a regular file with content 'ping' on the filesystem rather than waking up xrootd.
Not a big deal so far. One file of 4 bytes won't kill your system.

The problem will come on the next iteration, and is a generic second flow : the -p check on $PIPE is doing shell expansion. Now the value of PIPE is (on second iteration) /var/log/xrootd/.*.log
So if another file is there matching this pattern on top of the expected .xrootd.log, the result of the expansion will be several words, breaking the check and leading to :

logrotate_script: line 2: [: /var/log/xrootd/.bla.log: binary operator expected

Note that here I did a simple touch /var/log/xrootd/.bla.log, but in practice, you get it from the first problem of having a .*.log file and the error looks like :

logrotate_script: line 2: [: /var/log/xrootd/.*.log: binary operator expected


Reply to this email directly or view it on GitHub.



Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1