Article 4WP4H How to re-start a script or a service when user switch over ?

How to re-start a script or a service when user switch over ?

by
linom
from LinuxQuestions.org on (#4WP4H)
Hello Member,

I am looking for a solution on how to start or restart a service or execute a shell script whenever user switches from one user to another in a gnome environment. A case where a linux system has multiple users configured.
I can start the service / execute the shell script when the user login for the first time. But unable to find a solution when user swithces to other user.
For eg. if there are 2 users - User1 and User2. When User1 logins first time my service / shell scripts starts and switches to User2 login for the first time, then also my service / shell scripts restarts. But when User2 switches back to User1, my services does not restart.

For first time login, I added in xdg/autostart. But unable to find config when there is an user switch over.latest?d=yIl2AUoC8zA latest?i=JkWkZceEJVU:dUBOylxvEZM:F7zBnMy latest?i=JkWkZceEJVU:dUBOylxvEZM:V_sGLiP latest?d=qj6IDK7rITs latest?i=JkWkZceEJVU:dUBOylxvEZM:gIN9vFwJkWkZceEJVU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments