Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

Display a message to inform the user when the computer will shut down

APC UPS Data Center & Enterprise Solutions Forum

Schneider, APC support forum to share knowledge about installation and configuration for Data Center and Business Power UPSs, Accessories, Software, Services.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • APC UPS, Critical Power, Cooling and Racks
  • APC UPS Data Center & Enterprise Solutions Forum
  • Display a message to inform the user when the computer will shut down
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
BillP
Administrator BillP Administrator
5060
voidstar_apc
Janeway voidstar_apc
196
Erasmus_apc
Sisko Erasmus_apc
112
Teken
Spock Teken
109
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to APC UPS Data Center & Enterprise Solutions Forum
Solved
Anonymous user
Not applicable

Posted: ‎2021-06-30 01:59 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
12
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 01:59 AM . Last Modified: ‎2024-03-11 12:18 AM

Display a message to inform the user when the computer will shut down

Hello,

I am newbie when it comes to PowerChute Network Shutdown and how it works with how I setup my UPS Network Management Card 2, I am hoping someone can help shed some light.

I would like to display a message to inform the user that the computer will shut down. I read that an email could be send but I would like to a terminal which open to display a message or an alert box (like "notify-send" on Linux).

I tried on the web interface of PowerChute Network Shutdown:

Configure Events --> Notification

Where I put the IP address of my computer, but it didn’t work.

So I tried:

Configure Events --> Command File

Where I write a script in bash. In my script, I used the command “notify-send” to display an alert box. It didn’t work too.

So I tried:

Shutdown Settings --> run Command

Where I put the same script as before. It didn’t work too.

So I tried:

Shutdown Setting --> Notify Users but it didn’t work too

After I am gone to on the web interface of my UPS Network Management Card 2 and I tried:

Configuration --> Notification --> Event Action

But I haven’t of notification.

 

Has anyone ever had this problem?

If you have ideas, I'll take them.

Thanks in advance to anyone that responds to this post.

Marie

Labels
  • Labels:
  • UPS Management Devices & PowerChute Software
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
Anonymous user
Not applicable

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

Hi voidstar

I thank you for your answer and I apologize for answering only now. I have not had the time to test your proposed solution but I hope to do it next week.

I inform you for the result.

Marie

See Answer In Context

Reply

Link copied. Please paste this link to share this article on your social media post.

Replies 12
BillP
Administrator BillP Administrator
Administrator

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

Hi,

On a Windows system PowerChute will post to the screen.

Gi%2Fytq55EMoFyx%2F00CMJ8A%3D%3D.pngGi%2Fytq55EMoFyx%2F00CMJ8A%3D%3D.png

The notification last around 60 seconds prior to shutdown. 

On a Linux system you can write a script to send notification. If you need assistance with scripting syntax see Schneider Electric FAQ FA159559

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

Hi,

I thank you for your answer.

My script on Linux is:

#!/bin/sh

notify-send ‘message error’ ‘The computer will shut down’

sleep 15

 

I put on the command file et run Command but it didn’t work. I read Schneider Electric FAQ FA159559 but I don’t understand why it didn’t work. Can you help me please? Do I have a fault on my script?

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

By default notify-send delivers a notification to the user who runs it. In your case that's PowerChute, not the other users logged into the machine. I see a variety of solutions posted on the web for notifying all users... for example:

https://unix.stackexchange.com/questions/2881/show-a-notification-across-all-running-x-displays/2300...

I imagine there's going to be challenges with permissions also. If I were you, I'd test sending a notification using a separate account, not the one logged into the display server.

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

Hi,

I thank you for your answer voidstar.

I read your exemple and I tried solutions like:

#!/bin/sh

DISPLAY=:0 sudo –u user_display_0 notify-send “The computer will shut down”

 

The code works on the terminal. I put the script in “Command File” of "UPS On Battery" in “Configure Events” of PowerChute and it doesn’t work.

Is there a fault in my script? Or I do not use the right step?

Marie

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

That uses sudo to perform "notify-send" as a particular user. But "sudo" is locked down. Here's what happens when I try to run it as another user:

voidstar@starbase3:~$ su test
test@starbase3:~$ DISPLAY=:0 sudo -u voidstar notify-send "test 1.. 2.. 3..."
[sudo] password for test:
test is not in the sudoers file.  This incident will be reported.

So, the first problem is it asks for a password interactively, so that's not going to work from PowerChute. The second problem is my test user is not in the sudoers file. When I fix all of those, it still doesn't work.

I got the third answer (mivk) to work. Of course we're both running Ubuntu 16.04. I shortened his script to:

#!/bin/bash

title="Computer Shutting Down"
msg="We're shutting down now"

who | awk '{print $1, $NF}' | tr -d "()" |
while read u d; do
    id=$(id -u $u)
    . /run/user/$id/dbus-session
    export DBUS_SESSION_BUS_ADDRESS
    export DISPLAY=$d
    su $u -c "/usr/bin/notify-send '$title' '$msg'"
done

Made sure my user was in the sudoers file, and ran the script above using "sudo" to make sure it had the privilege to connect to everyone's DBUS session.

Linux really needs a better standard way to do this.

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

Hi,

I don’t understand this line :

 . /run/user/$id/dbus-session

What does it mean?

Marie

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

Hi Marie,

The dbus-session file contains the bus address for the particular user. It's in a form that can be directly executed by a shell script:

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-kji3ADFKWI

The "." command runs the dbus-session file which causes the variable DBUS_SESSION_BUS_ADDRESS to become bound to the bus address. In the next line we export the variable to the environment so that notify-send uses it.

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:00 AM . Last Modified: ‎2024-03-11 12:18 AM

Hi voidsta,

I thank you for your answer.

I tried your solutions but I have error message “/run/user/503/dbus-session : No such file or directory.

I checked and I haven’t the file /run/user. What does the /run/user file contain?

Marie

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

I guess it's probably distro-specific. I'm using Ubuntu 16.04 LTS; which distro are you using? Perhaps we can find a system-wide notification solution for your distro.

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

Hi,

I have Linux version 2.6.32-358 (gcc version  4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)).

Marie

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

0 Likes
0
1669
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

Hi Marie,

I looked around and didn't see anything specific to Red Hat Enterprise Linux 4. I did find this (replace X_user and X_userid with the username and user id respectively):

sudo -u X_user DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/X_userid/bus notify-send 'Hello world!' 'This is an example notification.'

I don't know if it'll work for you but it's worth a shot.

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

0 Likes
0
1670
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 02:01 AM . Last Modified: ‎2024-03-11 12:17 AM

Hi voidstar

I thank you for your answer and I apologize for answering only now. I have not had the time to test your proposed solution but I hope to do it next week.

I inform you for the result.

Marie

Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of