Upstart script for unison service

Asked by Alan Pater

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]

respawn

expect fork

exec unison -socket 2225
---------

Question information

Language:
English Edit question
Status:
Solved
For:
upstart Edit question
Assignee:
No assignee Edit question
Solved by:
Alan Pater
Solved:
Last query:
Last reply:
Revision history for this message
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 0.0.0.0:2225 0.0.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 ...

Revision history for this message
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)
respawn
expect fork
exec /usr/bin/unison -socket 2225 >> /var/log/unison.log 2>&1