Kcptun: Archlinux systemd-rc-local 中配置的kcptun在第一次开机时无法启动

Created on 22 Nov 2016  ·  8Comments  ·  Source: xtaci/kcptun

Archlinux systemd-rc-local 中配置的kcptun在第一次开机时无法启动,但是执行systemctl restart rc-local之后就启动了

Most helpful comment

@TooYoungTooSimp 我是这个做的,
在/usr/lib/systemd/system/下建立[email protected],其内容为:

[Unit]
Description=Kcptun Client Service
After=network.target

[Service]
Type=simple
User=nobody
ExecStart=/usr/bin/kcptun_client -c /etc/kcptun/%i.json
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

把配置文件client.json放在/etc/kcptun/下面,记得不要用log参数,否则报错
然后就是sudo systemctl start [email protected]
如果没报错的话,继续执行sudo systemctl enable [email protected]

All 8 comments

user0@localhost ~ % sudo systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled; vendor preset: disabled)
Active: active (exited) since Tue 2016-11-22 19:10:47 CST; 10min ago
Process: 384 ExecStart=/etc/rc.local (code=exited, status=0/SUCCESS)
Main PID: 384 (code=exited, status=0/SUCCESS)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/rc-local.service
└─426 /usr/bin/python /usr/sbin/sslocal -s 127.0.0.1 -m ××× -k ××× -a --fast-open -d start

Nov 22 19:10:46 localhost rc.local[384]: /Users/xtaci/.godeps/src/github.com/urfave/cli/app.go:254
Nov 22 19:10:46 localhost rc.local[384]: main.main
Nov 22 19:10:46 localhost rc.local[384]: /Users/xtaci/.godeps/src/github.com/xtaci/kcptun/client/main.go:406
Nov 22 19:10:46 localhost rc.local[384]: runtime.main
Nov 22 19:10:46 localhost rc.local[384]: /usr/local/go/src/runtime/proc.go:183
Nov 22 19:10:46 localhost rc.local[384]: runtime.goexit
Nov 22 19:10:46 localhost rc.local[384]: /usr/local/go/src/runtime/asm_amd64.s:2086
Nov 22 19:10:47 localhost.localdomain rc.local[384]: 2016-11-22 19:10:47 WARNING warning: server set to listen on 127.0.0.1:8388, are you sure?
Nov 22 19:10:47 localhost.localdomain rc.local[384]: 2016-11-22 19:10:47 INFO loading libsodium from libsodium.so.18
Nov 22 19:10:47 localhost.localdomain systemd[1]: Started /etc/rc.local Compatibility.

Aur中不是有人已经写好包,systemd 下enable kcptun的服务就行了
suod systemctl enable [email protected]
youconf在
/etc/kcptun/youconf.json
shadowsocks中使用kcptun监听的服务端口,其他不变,kcptun配置为shadowsocks的本地回环地址和监听端口,我是这样用的。

@bubbless 感谢你的帮助,但是我发现aur里面有两个包,一个叫kcptun-bin,一个叫kcptun-git,我应该安装哪一个?

并且问题还在于我一执行systemctl restart rc-local后ss和kcp就都好了

@TooYoungTooSimp 我是这个做的,
在/usr/lib/systemd/system/下建立[email protected],其内容为:

[Unit]
Description=Kcptun Client Service
After=network.target

[Service]
Type=simple
User=nobody
ExecStart=/usr/bin/kcptun_client -c /etc/kcptun/%i.json
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

把配置文件client.json放在/etc/kcptun/下面,记得不要用log参数,否则报错
然后就是sudo systemctl start [email protected]
如果没报错的话,继续执行sudo systemctl enable [email protected]

kcptun-bin里面已经写好了systemd的服务,我现在用的就是这个,很方便。

我使用的是 supervisord里面启动kcp 第一次开机的时候也会出错,需要手动重启一下 supervisord

谢谢大家的帮助,使用aur里面的systemd-kcptun服务的确能够一次启动了,不过rc-local依旧不能成功。我现在ss和kcp都在使用systemd的服务,目前一切正常。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edboffical picture edboffical  ·  4Comments

sosmygirl picture sosmygirl  ·  6Comments

weiyu99 picture weiyu99  ·  9Comments

cxjava picture cxjava  ·  8Comments

iskyhawk picture iskyhawk  ·  10Comments