Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Scripting for user session

Avatar of atorex
atorex asked on
Shell Scripting
1 Comment1 Solution449 ViewsLast Modified:
OK, I have the solution using DCOPserver, what I need is help creating a script that will execute each time the user tries a log in to a session this is what I have.
From a KDE standpoint, you can look at a few things with dcop.          
If more than one user is logged into KDE, you could see it via the  
dcop --list-sessions --user user                                    
  Active sessions for user /home/user :                              
In the above case, you can see that I have 2 users logged into KDE.    
If I want the first session for the user logged out, I can run      
dcop --user user --session .DCOPserver_x345-2__1 ksmserver default lo
gout 0 0 -1                                                            
Now, if I put this in a script inside /home/user/.kde/Autostart/    
and make it excutible, and if there are more than one sessions for the  
user, I call the above command to force the logout of the __2 session
This check is performed at every login of the user and when a second
login is performed, the user is prevented to do so, what I need is help with a basic script that could run dcop --list-sessions --user user then if more then one exists I want to kill the running session, the reason I need to do this is that the application running on auto log in uses javaPOS and multiple sessions causes issues with the peripherals.
I need help with syntax I woul like to do the following

if a session exists kill it before starting a new one. with the command  (dcop --list-sessions --user pos) and this command would kill it (dcop --user user --session .DCOPserver_x345-2__1 ksmserver default lo
gout 0 0 -1 ) i do need to insert the hostname  where X345 is, how would that work dont know.

scripting is not something I do so I would like any impute please (perhaps a bash scripting course would be ideal)
I would get a return with a session, if no return with command continue.
Avatar of asurianu

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers