Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
79301members
343972posts

PowerChute don't execute custom script

Solved
zakire_apc
Cadet
0 Likes
1
219

PowerChute don't execute custom script

This was originally posted on APC forums on 6/8/2013


Hi!

I have a SmartUPS 1000 connected via USB to an ESXi host. Then I have PowerChute installed on a virtual machine running Windows Server 2012 (running on the ESXi host). I have PowerChute Agent, Server and Console installed on the same server.

Everything is working as expected, I can monitor the UPS through the software or through SNMP, alerts are working and so on. However, my custom script is just not executing.

I have my Shutdown Sequence configured to start a custom bat-file with 0 minutes delay and 10 minutes later shutdown the operating system. The total shutdown sequence is configured to take 11 minutes and 30 seconds.

Under Power Failure I have told PowerChute to begin the shutdown procedure when the UPS is at runtime limit.

What the script does is that it SSHs into my ESXi and shut down all the VMs and then shut down itself. It also SSHs into my NAS and shut it down. The whole process takes about 5 minutes, meaning that PowerChute will never be able to shut the operating system down since the VM will already be powered off at that time.

The expected senario when the power fails is that the UPS should run on battery for about one hour, and when the runtime is 11 minutes left, PowerChute whould execute my custom script and shut down the whole enviroment, and then the UPS would shut down itself after 11 minutes and 30 seconds.

However, this is not the case.

The actual senario is that the UPS runs on battery for about one hour until the runtime is 11 minutes left, then PowerChute shut down the operating system, and then the UPS shut itself down after 1 minute and 30 seconds (meaning my NAS and my ESXi server and all running VMs is taken down abruptly).

To confirm that the bat-script is working, I have clicked the "Test"-button under Configure Shutdown Sequence, and that did work as expected.

Both the PowerChute services runs as Local System.

The bat-script is executing from C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles where SYSTEM has R/W access.

Here is the log from the UPS:

14:38:52  Monitoring Stopped

14:38:50  Sufficient Runtime Available

14:38:42  Insufficient runtime has been detected, PowerChute Business Edition will now start an immediate shutdown.

14:38:42  Shutdown process started

14:38:42  Low Runtime Remaining

13:28:18  Power Failed

Here is the bat-script (please not that sensitive information is replaced with X):

@echo off

C:

cd "C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles"

echo y | plink.exe -ssh 192.168.X.XXX -l XXXXX -pw XXXXX exit

plink.exe -ssh 192.168.X.XXX -l XXXXX -pw XXXXX /etc/init.d/poweroff

echo y | plink.exe -ssh 192.168.X.XXX -l XXXXX -pw XXXXX exit

plink.exe -ssh 192.168.X.XXX -l XXXXX -pw XXXXX /sbin/poweroff

exit

My question now is why the bat-script is not executing. It is working properly and it does the job when i test the script from PowerChute.

Thanks in advance for any help!

Best Regards,

Lucas Hökerberg


Accepted Solutions
BillP
Administrator Administrator
Administrator
0 Likes
0
220

Re: PowerChute don't execute custom script

This reply was originally posted by Bill on APC forums on 6/10/2013


Lucas,

Write a second command file that has 1 line. The second file will call - execute the original file.  Example in PowerChute enter the command file kickoff.cmd the file has 1 line in it "C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles\OringinalFileName"

You should also check out Kbase FA168226 http://www.apc.com/site/support/index.cfm/faq/

See Answer In Context

1 Reply 1
BillP
Administrator Administrator
Administrator
0 Likes
0
221

Re: PowerChute don't execute custom script

This reply was originally posted by Bill on APC forums on 6/10/2013


Lucas,

Write a second command file that has 1 line. The second file will call - execute the original file.  Example in PowerChute enter the command file kickoff.cmd the file has 1 line in it "C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles\OringinalFileName"

You should also check out Kbase FA168226 http://www.apc.com/site/support/index.cfm/faq/