Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
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
84578members
353848posts

How to run a command file on PCNS Virtual Appliance

APC UPS Data Center & Enterprise Solutions Forum

Schneider Electric support forum for our Data Center and Business Power UPS, UPS Accessories, Software, Services, and associated commercial products designed to share knowledge, installation, and configuration.

Solved
nfricker_apc
Crewman
Crewman
0 Likes
13
1452

How to run a command file on PCNS Virtual Appliance

This was originally posted on APC forums on 1/27/2017


My name is Norman, I have a Smart UPS  RT 10000XL. I Need to configure a Notification email to tell me qhen the UPS is on battery. The NMC does not support gmail account config (you cant configure port and SSL/TLS) I install a PCNS in a Windows Server 2008 and connect it to my UPS. Inside I configured it to shoutdown and run a command file I(the bach file send me an email) stored in my disk. I need to do the same with a PCNS Virtual Appliance, and I dont know how to execute a script, I don know the syntax.

I know that I cannot run a batch file on PCNS VA, what kind of file I need to run? what is the syntax? or the full path in PCNS VA ? where should I store the file?

Thanks for the help

 run command file

Attachments

Accepted Solutions
BillP
Administrator Administrator
Administrator
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 3/6/2017


Hi

Yes the path is /opt/APC/apc_on_batt.sh. 

See Answer In Context

13 Replies 13
BillP
Administrator Administrator
Administrator
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 1/30/2017


Hi,

The PCNS Appliance is a Linux operating system so you will need a shell script. Here is a Google link that will help with learning how to write shell scripts. 

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=how+to+write+shell+scri...

This is a link to Schneider Electric FAQ FA158559 that will help with syntax and troubleshooting the script.

As for where to save / store the file that is up to you. I suggest saving / storing it in /opt/APC/PowerChute That way it will be easy for anyone else to find and associate with PowerChute. 

On 1/27/2017 5:46 PM, Norman said:

I have a Smart UPS  RT 10000XL. I Need to configure a Notification email to tell me qhen the UPS is on battery. The NMC does not support gmail account config (you cant configure port and SSL/TLS) I install a PCNS in a Windows Server 2008 and connect it to my UPS.

What is the exact model of the RT10000? You can find the exact model information on the bar code sticker on the back or front of the unit.

 

Also, what model is the network card that is installed in the RT10000 and what firmware version is running on the card? That information can be found by logging into the card. If the card is an older model the information will be found under Administration, General, About. If the card is a newer model the information is under About, Network. 

The newer model network cards with updated firmware do support SSL/TLS. Those cards are model AP9630, AP9631, AP9635, AP9637SUM

Attachments
nfricker_apc
Crewman
Crewman
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This was originally posted on APC forums on 1/31/2017


Bill thanks for the help, 

I could wrote a very simple Shell script that sends me an email alert:

#!/bin/sh

ssmtp -v norman.fricker@gmail.com < msg.txt

I login my PCNS Virtual Appliance using putty and execute the file and works ok. But when I try to execute that file using the web interface it says that he can´t find the file.

I´ve send you two print screens.

THX

Attachments
BillP
Administrator Administrator
Administrator
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 1/31/2017


Hi,

Close the web interface and then re-launch it. If the script is still not recognized close the interface, stop and restart the PCNS daemon. The commands to stop and restart are service PowerChute stop, service PowerChute start. Once the daemon has restarted re-launch the web interface and the script should be available. 

voidstar_apc
Janeway
Janeway
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This was originally posted on APC forums on 1/31/2017


Also make sure your script is executable (ie, chmod 755) so you can run it via "./apc.sh" rather than "sh apc.sh"

nfricker_apc
Crewman
Crewman
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This was originally posted on APC forums on 1/31/2017


Bill, thanks  it worked ok. It recognized the file. From now on you are in my speed dial. Also thanks to voidstar

Last question, I ve Installed the VA, I need to install a PCNS in all my VM? or the Virtual Appliance does this for me? ( I know that in my host I have to set Guest Shutdown in VM Start up/shutdown) Do you have a Users manual with this configuration?

Thanks

BillP
Administrator Administrator
Administrator
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 2/1/2017


Hi,

On 1/31/2017 4:58 PM, Norman said:

Last question, I ve Installed the VA, I need to install a PCNS in all my VM? or the Virtual Appliance does this for me?

The PCNS Appliance sends a signal to the ESXi host that it needs to power down. The host will first send a power down signal to the VMs wait for the VMs to power down and then it will power down. You must install VMware tools on each VMs and configure guest startup/shutdown (as you mentioned). We have FAQ FA159688 that discusses this set-up and the PowerCbute Network Shutdown VMware User's Guide

All of this is assuming the PCNS Appliance is configured to power down a single ESXi host. If The PCNS Appliance has been configured to communicate with the ESXi host through vCenter Server then you can configured the VM shut down through PCNS. You will find information on PCNS and vCenter Server in Application Note 180, and PowerChute Network Shutdown VMware User's Guide. 

nfricker_apc
Crewman
Crewman
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This was originally posted on APC forums on 3/2/2017


Bill how are you?

I configured the Virtual Appliance, the web console recongnized my *.sh files, it recognized the full path of the files . I tested all the *.sh files in the console, one by one, all the files send an email just fine. But the web console don´t execute the files. Possibly I have written the wrong syntax, I tried /opt/APC/./apc_on_batt.sh,  /opt/APC/apc_on_batt.sh and  /opt/APC/sh apc_on_batt.sh (doesn't recognize the path) . Also make sure your script is executable (ie, chmod 755) and nothing. I have the same similar scripts in a PCNS on windows and the BAT files execute without problems.

in advance thanks for the help

BillP
Administrator Administrator
Administrator
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 3/3/2017


Hi,

After placing the .sh in /opt/APC did you stop and restart the PowerChute daemon? As I mentioned on 31 Jan sometimes you need to log out of the web interface and then log back in and if that does not resolve the issue you need to restart the service. If that does not work send a screenshot of /opt/APC after running the command ls -la 

BillP
Administrator Administrator
Administrator
0 Likes
0
1452

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 3/6/2017


Hi,

Not sure what is going wrong for you. I created a test script on my PCNS Appliance and it work properly.

The script reads

#!/bin/sh

echo "This is a test script" >> /opt/APC/PowerChute/test.txt

data >> /opt/APC/PowerChute/time.txt

When the script is run by PCNS it creates 2 text files in /opt/APC/PowerChute a test.txt file and a time.txt file.

nfricker_apc
Crewman
Crewman
0 Likes
2
1452

Re: How to run a command file on PCNS Virtual Appliance

This was originally posted on APC forums on 3/6/2017


Hi, ok, but what is the correct syntax in the full path "/opt/APC/apc_on_batt.sh" ? is this correct? somethig is not executinf the sh file in windows I dont have problems the bat files execute without problems.

In windows the full path " c:\APC\apc_on_batt.bat"

THANKS

BillP
Administrator Administrator
Administrator
0 Likes
0
1453

Re: How to run a command file on PCNS Virtual Appliance

This reply was originally posted by Bill on APC forums on 3/6/2017


Hi

Yes the path is /opt/APC/apc_on_batt.sh. 

Jasonk
Cadet
0 Likes
1
912

Re: How to run a command file on PCNS Virtual Appliance

Were you able to get this working? I have what sounds like the same problem. I am running the virtual appliance v 4.4.1. When I console into the VM or SSH I am able to execute command files. However when PCNS tries to execute a command file via a triggered event, it doesn't work. FWIW Event Viewer on the web UI does show "Running Command File" when the event is triggered. I created a simple .sh file that executes 

 

#!/bin/sh
echo "This is a command file test." >> /test.txt

 

It works when I execute it via console or SSH but not when called by PCNS. I set the file to chmod 755 and placed it in the /opt/APC/PowerChute/user_files directory.

Tags (1)
BillP
Administrator Administrator
Administrator
0 Likes
0
904

Re: How to run a command file on PCNS Virtual Appliance

@Jasonk 

 

Create the script in /opt/APC/PowerChute/user_files with the extension.txt. Then run the command chmod 755 scriptName.txt to make the script executable. Finally test the script. 

 

I tested with PCNS 4.4.1 virtual appliance and below are the results. My test script is named script.txt

scriptTest.png

 

NOTE: I deleted your duplicate post.  

Tags (1)