Headless install failing to restart on boot with data mounted on a smb share

Solved by creating the following systemd service:

/etc/systemd/system/insync-headless.service

[Unit]
Description=Insync Service
After=network.target
RequiresMountsFor=/PATH/TO/YOUR/MOUNTED/SHARE

[Service]
Type=oneshot
User=YOURUSERHERE
ExecStart=/usr/bin/insync-headless start
ExecStop=/usr/bin/insync-headless quit
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then enabling the service and setting it as a dependency for the multi-user target:

$ sudo systemctl enable insync-headless
$ ln -s ‘/etc/systemd/system/insync-headless.service’ ‘/etc/systemd/system/multi-user.target.wants/insync-headless.service’

Manually start/stop with:

$ sudo service insync-headless start/stop

I cobbled together this by reading systemd manuals, never done this before so it may do more than it needs. If it contains extra stuff (such as its dependencies) please feel free to post your suggestions. It does what it’s supposed to do though.

1 Like