Start Synergy (or any application) BEFORE logging in Ubuntu 16.04.2 LTS

Dee*_*ayh 16 boot synergy startup-applications xserver 16.04

Using Ubuntu 16.04.2 (Xenial) on Intel x64:{Both Processor and Ubuntu install}

This question has been answered a million times, but none of the solutions work. So I don't want to duplicate a question, but it hasn't been answered.

When I fire up a terminal and sudo -i, the following command works just as expected.

`root@user-pc:~# /usr/bin/synergyc -f --no-tray --debug INFO --name 
 user-pc 192.168.xxx.xxx:24800
 [2017-05-23T09:20:44] NOTE: started client
 [2017-05-23T09:21:01] NOTE: connecting to '192.168.5.100': 
 192.168.5.100:24800
 [2017-05-23T09:21:01] NOTE: connected to server`
Run Code Online (Sandbox Code Playgroud)

I am then able to utilize the program for it's purpose. However, I want this to be done automatically before login so that I can utilize it's purpose from the login screen. (Synergy allows you to use one keyboard and mouse across multiple computers, almost like a virtual KVM but instead of hitting switches, you just roll your mouse right onto the next screen as if they were all attached to one graphics card)

The first thing I tried was rc.local:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exec /usr/bin/synergyc -f --no-tray --debug INFO --name user-pc 192.168.5.100:24800

exit 0
Run Code Online (Sandbox Code Playgroud)

~~~ls /etc/rc.local -l:

-rwxr-xr-x 1 root root 390 May 22 20:56 /etc/rc.local

So it's definitely executable, but upon rebooting the PC:

~~~ps aux | grep syner:

`root  990  0.0  0.0  63656  5372 ?  Ssl  09:33  0:00 
 /usr/bin/synergyc -f --no-tray --debug INFO --name user-pc 
 192.168.5.100:24800`
Run Code Online (Sandbox Code Playgroud)

However it isn't doing what it is supposed to, even unity dialogs are being called saying something went wrong, which only happens when this executes, so I can safely assume it's that.

My safest assumption is that the program is being run just fine, the problem is that rc.local is run prior to the x session starting so any hooks to the keyboard and mouse are never established, which is also likely only done at the beginning of execution of synergyc and not attempted again beyond that point.

The second thing I tried was "Startup Applications", it works, but not until after login, which is not what we want going on here.

If my assumption is correct:

What is a way to call execution of a process after the x server is up, but before any user has to login.

If my assumption is not correct:

帮助

jri*_*oot 7

对于16.04.2创建以下文件(它不存在)

/etc/lightdm/lightdm.conf
Run Code Online (Sandbox Code Playgroud)

内容:

[Seat:*]
autologin-user=

[SeatDefaults]
greeter-setup-script=/usr/bin/synergyc --name <hostname> 192.168.x.x
Run Code Online (Sandbox Code Playgroud)

按照这个ubuntu wiki 指南获取更多信息。


编辑:

来自man synergyc

自动启动...

选项不得包含-f--no-daemon。确保没有旧的协同副本在运行,这样它们就不会干扰新的副本,这一点很重要。

  • 这真是太好了!很高兴知道,只需将它添加到 `/etc/lightdm/lightdm.conf` 就足以使其完全工作。也许将他必须添加的内容添加到答案中,而不仅仅是链接 ubuntu 链接。 (2认同)
  • 很确定这适用于旧版本的 Ubuntu,但不适用于我的。我创建了 /etc/lightdm/lightdm.conf 因为它不存在并放入上面的两行(当然将其更改为使用我自己的信息)我现在在屏幕加载时具有协同连接,但是我现在不再获取登录屏幕。它只是一个带有 X 光标的空白屏幕。`$ sudo find / -name lightdm.conf` 给出了 `/etc/init/lightdm.conf` 和 `/etc/lightdm/lightdm.conf`,后者是我手动创建的,其中包含两行。删除我创建的 lightdm.conf 会将其恢复到工作状态。 (2认同)