我试图使用以下unison.system文件为unison创建一个systemd服务:
[Unit]
Description=Unison Sync
After=network.target
[Service]
ExecStart=/home/adamfg/bin/unison default
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
Type=simple
User=root
Environment=HOME=/home/adamfg/
[Install]
WantedBy=multi-user.target
Alias=unison.service以下是位于default.prf中的/home/adamfg/.unison文件:
root = /home/adamfg/workplace
root = ssh://adamfg@my-server.com//home/adamfg/workplace
{Some Ignore Rules}
ignorecase = false
repeat = watch
log = true
logfile = /home/adamfg/.unison/unison.log
backup = Name *
maxbackups = 5
retry = 1
auto = true
batch = true
confirmbigdeletes = true
times = true
prefer = newer
terse = true
contactquietly = true
silent = true如果我运行/home/adamfg/bin/unison default,unison将启动并继续运行。
但是,当我尝试使用systemctl start unison.service运行unison,然后使用systemctl status unison.service查询状态时,我得到以下信息:
unison.service - Unison Sync
Loaded: loaded (/etc/systemd/system/unison.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-10-07 09:14:25 IST; 884ms ago
Process: 14607 ExecStart=/home/adamfg/bin/unison default (code=exited, status=3)
Main PID: 14607 (code=exited, status=3)我如何解决这个问题,使我能够作为一个系统d服务运行统一?
发布于 2019-10-07 12:14:20
问题是,unison在作为服务运行时无法确定ssh私钥文件的位置,但如果从命令行运行,它会自动为用户使用默认的密钥文件。
为了解决这个问题,我在我的default.prf文件中添加了以下行:
sshargs= -oIdentityFile=/path/tos/ssh/key/id_rsa发布于 2022-05-03 18:01:38
这两台机器上的锁都无法启动。删除这两个锁有助于修复它。
unison -ui text
Fatal error: Warning: the archives are locked.
If no other instance of unison is running, the locks should be removed.
The file <file_URI> on host <hostname> should be deleted
The file <file_URI> on host <hostname> should be deleted
Please delete lock files as appropriate and try again.https://askubuntu.com/questions/1179242
复制相似问题