Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1807  / 3 Years ago, sat, july 17, 2021, 8:36:08

Is it possible to write a shell script that enables any user (may not be root) to set a message(e.g. "Download on progress do not turn off" etc.) which will be conveyed like pop-up message (zenity or notify-send) to all other users. If any user is not there at the time of throwing the message they must get it on login or unlocking their screen.


More From » scripts

 Answers
0

Nice question. Will give just an half answer... just a seed to see if someone can prepare something starting on this. I have tested this in my system, two users (ubuntu and romano, the two administrators).



I go to a VC and log in as ubuntu --- then I run



sudo sudo -u romano DISPLAY=:0.0 zenity --warning


(the first sudo switch to superuser, the second sudo execute zenity as the user romano)



from a virtual console, the message will appear in "romano" graphical environment.



I suppose that with a bit of mangling the output of w to get the DISPLAY and the users and looping over them it would be possible to have a working solution. Non-graphical connected users can be informed using wall.



I see really difficult to do that without superuser privileges, tough.


[#28458] Saturday, July 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fittecanap

Total Points: 322
Total Questions: 100
Total Answers: 105

Location: Israel
Member since Tue, Nov 17, 2020
3 Years ago
;