Georg

start/stop synergy via command line

7 posts in this topic

Hi,

I use synergy 1.8.8 to share input devices between my desktop and my notebook, both running LINUX.

The notebook is sitting in a docking station, and on demand, I can extend the notebook screen to the desktop monitor. When doing the switch from "notebook only display" to "extended display" via xrandr while synergy is active, the mouse will be trapped in a fraction of my desktop monitor which is as large as the notebook screen. I.e. there is a geometry issue here with synergy, which I can easily work around by first clicking "Stop" in the context menu of the synergy icon in the tray, then doing the screen extension command and finally resuming synergy clicking "start". To simplify this process, I want to do the "Stop/Start" synergy in the same script I use to do the screen expansion.

So, long story short, the simple question is: what is the command-line command to talk to an existing synergy instance to make it Stop/start?

best

Georg

 

Share this post


Link to post
Share on other sites

this should do the trick

killall synergys

# randr stuff

synergys

requires that the Synergy Server Executeable is somewhere in your PATH folders for executeables - if installed with your Package Manager it should be. If not you have to include the path to the Executeable, too.

Share this post


Link to post
Share on other sites

first: thanks for the reply!

And to the topic: yeah, there's always that "kill 'em all" thing, but I thought it might be possible to do it via a switch (IF synergy itself is doing it differently at all?):

synergy running normally:

ps -Al | grep syner
0 S  1050   971   941  0  80   0 - 179081 SyS_po ?       00:01:06 synergy
0 S  1050  4866   971  0  80   0 - 36322 -      ?        00:00:00 synergyc

"stop" in tray icon:

ps -Al | grep syner
0 S  1050   971   941  0  80   0 - 179081 -     ?        00:01:06 synergy

"start" in tray icon:

ps -Al | grep syner
0 S  1050   971   941  0  80   0 - 179081 -     ?        00:01:06 synergy
0 S  1050  5449   971  0  80   0 - 19840 -      ?        00:00:00 synergyc


so, what the button is doing is indeed probably as simple as a

killall synergyc

I'm gonna try...

Share this post


Link to post
Share on other sites

ok, it turns our to be a little more tricky:

synergyc is the client, which by default has the restart feature enabled, so just killing synergyc via killall will just trigger an instant restart.

My current solution is therefore a

killall synergy

followed by a

killall synergyc

which first kills the shepherd preventing the instant restart and then the client.

This appears like a "rough" method to solve this, so just in case someone cares:

I'm still interested in the solution that synergy itself is using when re-starting the client only on demand.

Share this post


Link to post
Share on other sites

Hi clown,

thanks for the answer. You are suggesting to re-start the server? I don't start the server via systemd (I don't know the "service" command?), but of course I could as well kill the server using my above listed sequence. But even then, my question would still be: via the GUI I can "stop" the synergys/c component and re-start it by clicking "stop/start". When doing so, the synergy process keeps running - even when synergy is not started via systemd - how does it do that?

Share this post


Link to post
Share on other sites

I run synergy server on Mac, and client on Debian linux.

The client (synergy-service) runs as a systemd service which will respawn if killed. 
See /lib/systemd/system/synergy.service

The "synergy-core" process spawns a child process (synergy-core) which does the actual work.
e.g.

ps -ef|grep syn
root      5425     1     /usr/bin/synergy-service
bclown    5440  5425     /usr/bin/synergy-core --client -f --run-as-uid 1000 \
  							  --debug DEBUG --name mylinuxbox  \
							  --enable-drag-drop --profile-dir /var/lib/synergy \
 							  --log /var/log/synergy/synergy-core.log 127.0.0.1:24801

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now