Upstart script for unison service

Asked by Alan Pater on 2011-10-25

I am trying to get unison running as a socket service and have created an upstart script for that purpose.

Trouble is that clients cannot connect. I suspect that the service is not really starting properly, but am not sure how to tell.

The script is as follows:
# upstart script to start unison socket service

description "unison service"
author "Alan Pater <email address hidden>"

start on runlevel [2345]

stop on runlevel [016]


expect fork

exec unison -socket 2225

Question information

English Edit question
upstart Edit question
No assignee Edit question
Solved by:
Alan Pater
Last query:
Last reply:
Alan Pater (alan-pater) said : #1

Further testing, using a /etc/init.d/unison script:

~$ sudo /etc/init.d/unison start
 * Starting Unison daemons
                                                                                                                                         [ OK ]
~$ sudo netstat -tulpn
Conexiones activas de Internet (solo servidores)
Proto Recib Enviad Dirección local Dirección remota Estado PID/Program name

tcp 0 0* ESCUCHAR 2052/unison

The upstart init script, however, does not seem to attach to the desired port:

~$ sudo service unison start
unison start/running

~$ sudo netstat -tulpn

... nada ...

Alan Pater (alan-pater) said : #2

I found the problem after enabling extra logging.

   Fatal error: exception Util.Fatal("Environment variable HOME not found")

Here is the working script:

description "unison service"
author "Alan Pater <email address hidden>"
env HOME=/home/xobilyol
start on (local-filesystems and net-device-up IFACE!=lo)
expect fork
exec /usr/bin/unison -socket 2225 >> /var/log/unison.log 2>&1