PDA

View Full Version : Autostarting software with systemd


iltsu
2014-01-02, 01:44
I installed btsync to my phone, it runs fine but can't get it starting with systemd.
[root@localhost system]# cat btsync.service
[Unit]
Description=BTSync
After=network.target

[Service]
User=nemo
ExecStart=/home/nemo/btsync

[Install]
WantedBy=multi-user.target


systemctl start btsync.service doesn't give any error.

Gigadoc2
2014-01-09, 00:23
What does systemctl status btsync.service say?

kimmoli
2014-01-09, 10:29
To autostart at boot
systemctl enable btsync.service

iltsu
2014-01-12, 15:52
To autostart at boot
systemctl enable btsync.service

Well, it doesn't still work. I think there is something wrong with that script.

fLegmatik
2014-01-25, 16:17
[root@localhost system]# systemctl status btsync.service
btsync.service - BitTorrent Sync application
Loaded: loaded (/lib/systemd/system/btsync.service; disabled)
Active: active (running) since Sat, 25 Jan 2014 21:55:40 +0600; 1s ago
Process: 9964 ExecStart=/usr/local/bin/btsync --config %h/.config/btsync/btsync.config (code=exited, status=0/SUCCESS)
Main PID: 9971 (btsync)
CGroup: name=systemd:/system/btsync.service
└ 9971 /usr/local/bin/btsync --config /home/nemo/.config/btsync/btsync.config

[root@localhost system]# cat /lib/systemd/system/btsync.service
[Unit]
Description=BitTorrent Sync application
After=network.target

[Service]
Type=forking
User=nemo
ExecStart=/usr/local/bin/btsync --config %h/.config/btsync/btsync.config
PIDFile=%h/.config/btsync/sync.pid

[Install]
WantedBy=multi-user.target


PIDFile must be the same as pid_file in btsync.config or storage_path in btsync.config must be "/home/nemo/.config/btsync".
# systemctl enable btsync.service
also works fine.