How to start inSync at O/S boot-time such that UI can attach to it later

Hello:

I would like to use “/etc/rc.d/rc.local” to start inSync like this:

su - jdoe -c '/usr/bin/insync-headless start'
        -or like -
su - jdoe -c '/usr/bin/insync start'

Using /usr/bin/insync-headless starts the daemon process at boot-time fine, but when I optionally start the X-window manager later on and launch “insync” within it, it doesn’t attach to the already running process. Instead, it informs me that “insync” is already running, and exists.

Next, using plain /usr/bin/insync doesn’t start the daemon process at boot-time (or maybe it does, but exits because it doesn’t find an X-Window manager to start an accompanying indicator applet).

So my question …
I always want to start “insync” at boot-time, but depending on the computer, I may or may-not start an X-Window session/manager. So what startup command syntax do I use in “/etc/rc.d/rc.local” so that (1) if I choose not to start an X-Window manager, it just runs headless and (2) if I choose to start an X-Window manager, the “insync” indicator simply connects to the already running process.

Thank you!

@NYCeyes There is no current way to connect to an already running Insync process unfortunately. Maybe as an alternative you could use different scripts (insync vs insync-headless) based on the runlevel?

Thanks. That’s not really going to solve my problem/use-case. I need more of a client/server behavior, where I just start the daemon up at boot-time without regard to run-level. And then access/connect to the service via the CLI and/or via the Applet. I may/may-not start the Windowing system. Thanks.

a solution is to run headless at boot-time.
and at specific user login to call ‘/usr/bin/insync-headless quit’ after and /usr/bin/insync start at login
here is an answer how to run command at login for ubuntu

http://askubuntu.com/questions/270049/how-to-run-a-command-at-login