Page 1 of 1

rc.local command not running??

Posted: Mon Feb 09, 2015 3:37 pm
by kghunt
I have synergy set up on my laptop and I can get the pi to connect to it no problem. I cannot however get rc.local to run the command.

Code: Select all

sudo /usr/bin/synergyc 10.10.9.55

_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"

exit 0
The original IP bit still works so the command must have run but for some reason synergy does not connect.

Paradoxically if I run

Code: Select all

sh -e /etc/rc.local
synergy connects.

Whats going wrong? I suspect that synergy doesn't run for some reason but I cannot work out what.

Re: rc.local command not running??

Posted: Mon Feb 09, 2015 4:30 pm
by Paeryn
It should report any errors to syslog (/var/log/syslog) so check there to see if it tells you anything - it should be near the end of the file. It may be something like X11 hasn't finished starting by the time synergyc is starting. If so have you tried running it from your .xsession ? That way it only runs when you've logged into X11.
Edit:
Just realised, you may not have a .xsession file in your home directory (it doesn't get created if there's nothing to put in it), if so and you want to try running synergyc from it just create .xsession in your home dir - it's a standard shell script - just make sure that anything you put in there either runs in the background or quits as X11 won't finish logging you in until the script ends.

Re: rc.local command not running??

Posted: Mon Feb 09, 2015 5:21 pm
by RaTTuS
1) you don't need sudo in rc.local as that is run as root anyway

Re: rc.local command not running??

Posted: Tue Feb 10, 2015 1:47 pm
by kghunt
I realised that. I took it out but still no dice.

Re: rc.local command not running??

Posted: Tue Feb 10, 2015 1:50 pm
by RaTTuS
what about the log files ?

Re: rc.local command not running??

Posted: Tue Feb 10, 2015 4:59 pm
by kghunt
Is there a specific log for rc.local or is it syslog or messages? I cant see any errors relating to it.

Re: rc.local command not running??

Posted: Tue Feb 10, 2015 11:37 pm
by Paeryn
kghunt wrote:Is there a specific log for rc.local or is it syslog or messages? I cant see any errors relating to it.
The docs for synergyc say that it reports errors via syslog unless it's forced to run in the foreground (in which case they would be sent to the terminal like normal).
init.d (and hence anything run from /etc/rc.local) doesn't automatically redirect output anywhere (though most of the scripts and daemons do).