New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望能够自动后台,或者把后台用法写上 #5

Closed
xou130 opened this Issue Mar 31, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@xou130
Copy link

xou130 commented Mar 31, 2017

好像现在是不能自动后台的,我是用了nohup加disown做到后台运行不退出,用screen也行就是比这两个办法占资源(在资源比较吃紧的云服务器上)
全命令是这样的
$nohup {./otunnel...} >{日志输出到文件} 2>&1 &
$jobs -l
$disown -h %{上条命令里那个[]中数字,一般是1}

@gwind

This comment has been minimized.

Copy link
Contributor

gwind commented Mar 31, 2017

考虑到 golang 的特性,和容器的现状。我们没有做 daemon 努力。
目前,保持后台运行的方式很简单,推荐(含你提到的2个方法):

  1. otunnel ... >> otunnel.log 2>&1 & 即可,无需 nohup
  2. screen / tmux
  3. supervisord
  4. docker
  5. systemd

btw, 已经添加FAQ : https://github.com/ooclab/otunnel/wiki/FAQ.zh_CN

Thanks 👍

@zhuce30hao

This comment has been minimized.

Copy link

zhuce30hao commented Jan 4, 2018

@gwind systemd的用法查了好多资料,不知道该怎么弄,请作者赐教

@xou130

This comment has been minimized.

Copy link
Author

xou130 commented Jan 4, 2018

搞不来直接用screen,直接解决不麻烦

@gwind

This comment has been minimized.

Copy link
Contributor

gwind commented Jan 4, 2018

@zhuce30hao 我用 supervisord 的,systemd 可以查看下 https://unix.stackexchange.com/questions/15348/writing-basic-systemd-service-files

supervisor 的配置

参考 Supervisor - 管理你的进程

注意 : CentOS 配置文件后缀为 ini , Ubuntu 好像是 conf

server 端

创建文件 /etc/supervisord.d/otunnel.ini

[program:otunnel-listen]
command=/opt/bin/otunnel listen :10000 -d -s 你的密钥字符串
autostart=true
autorestart=true
log_stdout=true
log_stderr=true
stdout_logfile=/var/log/otunnel-listen.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=12
redirect_stderr = true

client 端

创建文件 /etc/supervisord.d/otunnel.ini

[program:otunnel-client]
command=/opt/bin/otunnel connect server的IP:10000 -d -s 你的密钥字符串  -t "r:127.0.0.1:22::10022"
autostart=true
autorestart=true
;log_stdout=true
;log_stderr=true
stdout_logfile=/var/log/otunnel.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=12
redirect_stderr = true
@fanvinga

This comment has been minimized.

Copy link

fanvinga commented Feb 13, 2018

@gwind btw我补充一个docker的.可以参考我博客 vinga.tech/otunnel .用docker的话有docker daemon看着.--restart=always来监控比supervisor好用.还不需要自己设置.

@gwind

This comment has been minimized.

Copy link
Contributor

gwind commented Feb 18, 2018

@fanvinga 👍 docker 统一 application 的管理/监控确实很好,也是未来主流方式。
我增加到 wiki 了
https://github.com/ooclab/otunnel/wiki

@fanvinga

This comment has been minimized.

Copy link

fanvinga commented Feb 18, 2018

哈哈哈.谢谢.希望otunnel越做越好:)

@gwind gwind closed this Oct 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment