首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >服务以状态代码3退出

服务以状态代码3退出
EN

Ask Ubuntu用户
提问于 2019-10-07 08:36:22
回答 2查看 1.1K关注 0票数 0

我试图使用以下unison.system文件为unison创建一个systemd服务:

代码语言:javascript
复制
[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文件:

代码语言:javascript
复制
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查询状态时,我得到以下信息:

代码语言:javascript
复制
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服务运行统一?

EN

回答 2

Ask Ubuntu用户

发布于 2019-10-07 12:14:20

问题是,unison在作为服务运行时无法确定ssh私钥文件的位置,但如果从命令行运行,它会自动为用户使用默认的密钥文件。

为了解决这个问题,我在我的default.prf文件中添加了以下行:

代码语言:javascript
复制
sshargs= -oIdentityFile=/path/tos/ssh/key/id_rsa
票数 1
EN

Ask Ubuntu用户

发布于 2022-05-03 18:01:38

这两台机器上的锁都无法启动。删除这两个锁有助于修复它。

代码语言:javascript
复制
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.
票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1179242

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档