Creating init script to run adaptor at startup

To run a connector every time its server is booted you need to create a custom init file.

The init file can be organized differently depending on the distribution used and the init systems the distribution adopts.

System V

This can still be found in old systems but the new distribution will use one of the two systems described below.


Create a new configuration file in /etc/init/ with a name like adaptor.conf and copy the following code inside. Modify the directory according to your system.

# Example Adaptor - run adaptor as a daemon
# Adaptor for Sharepoint/fileserver/AD/... that sends feeds to a GSA

description "runs adaptor at start time"
env JAVADIR=/usr/lib/java
start on runlevel [2345]
stop on runlevel [!2345]

expect fork

cd /dir/with/adaptor/files
$JAVADIR/bin/java -jar adaptor-sharepoint-4.1.0-withlib.jar
end script

You can check if the script has any sort of syntax error using the command:

init-checkconf /etc/init/adaptor.conf/etc/init.d/rc

and then start the script using:

sudo start adaptor


Create a new file in the directory:


and copy the following code to /etc/systemd/system/ (changing the directory according to your system, /etc/init.d/rc)

Description=Run adaptor at start time

ExecStart=/bin/sh -c "cd /dir/with/adaptor/files && /dir/with/java/binary/java -jar adaptor-sharepoint-4.1.0-withlib.jar


In the console, run the following commands:

sudo systemctl daemon-reload

sudo systemctl start adaptor.service

The first command lets the system know that a new service is available. The second command starts the service.

Was this helpful?
How can we improve it?