[Nut-upsuser] UPSLog rotating

Arjen de Korte nut+users at de-korte.org
Wed Sep 17 18:21:20 UTC 2008


Citeren "Tuc at T-B-O-H.NET" <ml at t-b-o-h.net>:

> 	Trying to rotate the ups.log on a FreeBSD 7.0 system
> and its not being nice about it.
>
> 	I tried the "quick and dirty" way by doing :
>
> 	mv /var/log/ups.log ${DATEDDIRECTORY}/ups.log
> 	kill -1 `cat /var/db/nut/upslog.pid`

This is awkward. Doesn't FreeBSD have 'logrotate'?

> 	I get :
>
> Sep 17 10:57:20 valhalla upslog[81972]: could not reopen logfile  
> /var/log/ups.log: Permission denied

What do you expect? After startup (and opening the logfile), upslog  
will drop privileges. See 'man 8 upslog'. I would be surprised if it  
would be able to create a file in /var/log then.

> 	So I stop upslog, remove the file, and start it to get a
> clean/fresh file. It shows me :
>
> -rw-r--r--  1 root  wheel  36 Sep 17 10:59 /var/log/ups.log
>
>
> 	So I change my script to :
>
>
> 	mv /var/log/ups.log ${DATADIRECTORY}/ups.log
> 	touch /var/log/ups.log
> 	chown root:wheel /var/log/ups.log
> 	chmod 644 /var/log/ups.log
> 	kill -1 `cat /var/db/nut/upslog.pid`
>
> 	but I'm still getting :
>
> Sep 17 10:59:48 valhalla upslog[82020]: Signal 1: reopening log file
> Sep 17 10:59:48 valhalla upslog[82020]: could not reopen logfile  
> /var/log/ups.log: Permission denied

Well, that last line pretty much says what is wrong, doesn't it?

> 	Any thoughts where I'm going wrong??

See above. You need to restart upslog or put the logfile in a place  
where the user running upslog has write access.

Best regards, Arjen
-- 
Please keep list traffic on the list



More information about the Nut-upsuser mailing list