Skip to content
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

启动命令里必须加-u才可以启动 #26

Closed
heartnn opened this issue Apr 21, 2020 · 11 comments
Closed

启动命令里必须加-u才可以启动 #26

heartnn opened this issue Apr 21, 2020 · 11 comments

Comments

@heartnn
Copy link

heartnn commented Apr 21, 2020

如这样:

/root/smargate/proxy_server -i1000 -o1000 -w8 -u xxxxxxxxxxxxx:y

另外代理服务端也必须这样启动,但代理服务器带上-u参数后会被识别成服务端。

直接运行不带参数比如/root/smargate/proxy_server会报错:

root@fqdn:~# /root/smargate/proxy_server
no environment-variable "SMS_HOME" define.
Server config file is: /root/conf-proxy.xml
[INFO]  plugin path is:/root/plugin/
[WARNING]       NOT-FOUND library in :/root/plugin/
[ERROR] load plugin module error.

*****************************NO PLUGIN INFORMATION*****************************
[ERROR] you must assign user-name whith command option -u xxx:yyy


The module[MAINCONTROLER] has been exited!

[INFO]  Application has been exited!

the server stop.

附我的代理服务器配置:

<?xml version="1.0" encoding="GBK"?>
<app-config code="PROXY" name="proxy-server">
	<app-parameter>
		<proxy-service-port value="xxxxx"/>
		<!--
		<ssl-cacert-file value="xxx.crt"/>
		<ssl-privatekey-file value="xxx.key"/>
		-->
   </app-parameter>
   <moudle-parameter>
	<log-level value="LOG_ERROR"/>
	<log-write-mode value="CONSOLE_ONLY"/>
  </moudle-parameter>
</app-config>

服务端配置:

<?xml version="1.0" encoding="GBK"?>
<app-config code="PROXY" name="proxy-server">
	<moudle-parameter>
		<log-level value="LOG_ERROR"/>
		<log-write-mode value="CONSOLE_ONLY"/>
		<app-name value="DiskStation" />
		<app-description value="DiskStation smarGate" />
		<user-audit value="xxxxxxxxxxxxx:y"/>
	</moudle-parameter>
	<channel address="服务器IP:端口" ssl="false" />
</app-config>

PS: 代理服务器从我一开始用的时候是可以的,大概3月份的时候的版本,最近跟进更新,才发现不能启动了。

另外手机上的访问点和描述都不正常,只显示
访问点:network entry.
描述:common entry of intern net.

@lazy-luo
Copy link
Owner

这个是没有找到配置文件
默认情况配置文件会在可执行文件当前目录查找,找不到配置文件会要求输入-u来指定用户id及index
指定配置文件全路径请用-f 参数指定

@lazy-luo
Copy link
Owner

“另外手机上的访问点和描述都不正常,只显示
访问点:network entry.
描述:common entry of intern net.”
这是因为你用-u执行的,系统会给个默认的描述。

@lazy-luo
Copy link
Owner

代理服务端无配置启动不用-u参数,使用-m xxx试试,xxx为代理服务器端口号
个人比较懒没做详细的命令行教程,一般来讲依赖配置文件就都ok了

@heartnn
Copy link
Author

heartnn commented Apr 21, 2020

大哥你这个不严谨啊,如果我配置文件放到/root/smargate,那么我必须执行cd /root/smargate && ./proxy_server bulabula,而root用户环境默认执行是在/root,所以我执行/root/smargate/proxy_server,程序会检测配置文件应该在/root里,这样错误的。

所以我的systemd也得改一下了,以前我得到对的结果,可能就是我先执行了cd /root/smargate

@lazy-luo
Copy link
Owner

1、严谨点来讲,默认获取配置文件路径为当前工作目录
2、你可以使用-f 指定配置文件路径
能用就行,不必纠结

@heartnn
Copy link
Author

heartnn commented Apr 21, 2020

写systemd服务的时候,它可不管你是什么工作目录吧,所有路径都必须是绝对路径。
这个-f 折腾我好长时间啊。

@lazy-luo
Copy link
Owner

1、-f 能解决你的问题吧。
2、如你所愿,还是决定严谨点吧,方便至上
更新见网盘~

@heartnn
Copy link
Author

heartnn commented Apr 21, 2020

更新真快 image

@heartnn heartnn closed this as completed Apr 23, 2020
@satnosun
Copy link

大哥你这个不严谨啊,如果我配置文件放到/root/smargate,那么我必须执行cd /root/smargate && ./proxy_server bulabula,而root用户环境默认执行是在/root,所以我执行/root/smargate/proxy_server,程序会检测配置文件应该在/root里,这样错误的。

所以我的systemd也得改一下了,以前我得到对的结果,可能就是我先执行了cd /root/smargate

您好,能问一下您的systemd的配置文件是怎么写的吗?我写的总是无法开机自启,需要手动start。

@heartnn
Copy link
Author

heartnn commented May 14, 2020

大哥你这个不严谨啊,如果我配置文件放到/root/smargate,那么我必须执行cd /root/smargate && ./proxy_server bulabula,而root用户环境默认执行是在/root,所以我执行/root/smargate/proxy_server,程序会检测配置文件应该在/root里,这样错误的。
所以我的systemd也得改一下了,以前我得到对的结果,可能就是我先执行了cd /root/smargate

您好,能问一下您的systemd的配置文件是怎么写的吗?我写的总是无法开机自启,需要手动start。

smargate.service

[Unit]
Description=smarGate Proxy Daemon
After=network.target
Wants=network.target

[Service]
Type=simple
ExecStart=/root/smargate/proxy_server -f /root/smargate/conf-proxy.xml
ExecStop=/bin/kill $MAINPID
PIDFile=/run/smargate.pid
Restart=always

[Install]
WantedBy=multi-user.target

就这样应该就行了,systemctl start以后ps查一下后台看看是否运行成功,或者看systemctl的status也可以。

@satnosun
Copy link

就这样应该就行了,systemctl start以后ps查一下后台看看是否运行成功,或者看systemctl的status也可以。

多谢指导,可以了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants