[Resolved] Problems with apcupsd starting at regular times when disabled.


Recommended Posts

I was using the built in UPS settings in Unraid, but this was not sufficient for my needs as it didn't support other item on my network, so I installed NUT server on a Raspberry Pi, connected the UPS USB cable to it, added the NUT docker to Unraid and connected it all up to the Pi NUT server while switching the UPS Settings> Start APC UPS daemon to No. 
Everything seems to be working with the NUT server, all my devices see it and are set up accordingly, including Unraid. Unfortunately, every week on a Sunday at approx 04:40 I get a notification

apcupsd 3.14.14 (31 May 2016) slackware startup succeeded

Communications with UPS lost

these errors continue to be logged until I manually switch off the daemon Settings>UPS Settings.

When I go to the Settings>UPS Settings tab, the status is showing as running, despite the Start APC UPS daemon showing as no. The way to switch this off is to click the default button which resets it. 

FWIW, I have ran cat /etc/cron.d/root and nothing is listed as running around 4am on a weekly basis. 

Has anyone else experienced this or can anyone give me an idea on how to apply a correct fix other than setting a cron job a few minutes after the daemon starts to switch it off?

 

Edited by Boyturtle
Link to comment
  • 2 weeks later...
On 2/11/2022 at 12:58 PM, JonathanM said:

apcupsd has clients for windows, osx and linux. What other items do you need?

https://sourceforge.net/projects/apcupsd/files/

Thanks for your reply and apologies for not replying sooner nor making my earlier post clearer. My preference is to run the UPS management on a device that sips power (hence the Pi) and my unraid server is much more power hungry. Doing it this way allows me to shut unraid down before other devices on my network.

 

What I'd like to achieve here is to disable the apcupsd 3.14.14 (31 May 2016) slackware startup, but have no idea how to to stop this. Effectively, I'd like the deamon to revert to how it was before I made the initial changes when adding the UPS. As I stated in my earlier post, there is nothing in cron to indicate that there is anything in place to start at 4:40 every Sunday morning.

 

Do I need to make changes in unraids /etc/apcupsd/apcupsd.conf file, /etc/rc.d/rc.apcupsd or an altogether different file?

Link to comment
27 minutes ago, Squid said:

That seems to imply it's the weekly schedule.  You sure there's nothing running via user scripts (if installed)

 

Install Dynamix Schedules and then look at Settings - Schedules - Fixed Schedules or

 

ls /etc/cron.weekly

 

Hi @Squid its not weekly as that is running at 4.30 its daily. Its the log rotate fuction is restarting it.

 

root@unraid:/usr/sbin# cat /etc/logrotate.d/apcupsd 
/var/log/apcupsd.events {
  rotate 4
  weekly
  notifempty
  missingok
  postrotate
    /etc/rc.d/rc.apcupsd restart 1>/dev/null || true
  endscript
}

 

Any ideas on how the file is created or is it because I have an enabled its created logs even now I have disabled?

 

do I just need to delete the apcupsd.events files?

Edited by SimonF
Link to comment
48 minutes ago, Squid said:

You sure there's nothing running via user scripts (if installed)

My only weekly scripts are the cleaning up of plex cached files and ClamAV scan, nothing apcupsd related.

Installed Dynamix Schedules, user.script.start.weekly.sh runs at 4.30 on Sunday and exportrotate, logrotate, user.script.start.daily.sh run daily at 4.40.

My output from cat /etc/logrotate.d/apcupsd is the same as @SimonF

/var/log/apcupsd.events {
  rotate 4
  weekly
  notifempty
  missingok
  postrotate
    /etc/rc.d/rc.apcupsd restart 1>/dev/null || true
  endscript
}

 

As I'm not using unraid's apcupsd, am I safe to edit /etc/logrotate.d/apcupsd and comment out the line    /etc/rc.d/rc.apcupsd restart 1>/dev/null || true? Should this stop the daemon restarting?

Link to comment
  • 2 weeks later...
  • Boyturtle changed the title to [Resolved] Problems with apcupsd starting at regular times when disabled.
  • 1 year later...

To make changes persistent:
 

Disable apcupsd by resetting settings to Default in UPS settings

 

Open the terminal and copy your current logrotate script for apcupsd to your boot flash drive:

mkdir -p /boot/config/custom/ && cp /etc/logrotate.d/apcupsd /boot/config/custom/apcupsd

 

Open the script you copied on your flash drive using an editor (e.g. nano /boot/config/custom/apcupsd) and remove the following lines:

postrotate
    /etc/rc.d/rc.apcupsd restart 1>/dev/null || true
endscript

 

Mine looks like this after making the changes:

/var/log/apcupsd.events {
  rotate 4
  weekly
  notifempty
  missingok
}

 

Now make sure your /boot/config/go script will overwrite the logrotate.d config with the updated file on boot:

echo "cp /boot/config/custom/apcupsd /etc/logrotate.d/apcupsd" >> /boot/config/go

 

To test that it works and apply the changes now, copy the file and run the logrotate job:

cp /boot/config/custom/apcupsd /etc/logrotate.d/apcupsd && /etc/cron.daily/logrotate

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.