qinglong icon indicating copy to clipboard operation
qinglong copied to clipboard

Is it possible to setup a schedule as a daemon? 能否把计划任务设置成守护进程?

Open ErixWong opened this issue 1 year ago • 2 comments

Clear and concise description of the problem

I have some node.js projects need to run as daemon. I tried to set the schedule run every 5 minutes, but I found Qinglong just fork a new instance everytime and keep old instance running.

我有几个node.js需要以守护进程方式运行,也就是说需要保证其长期运行。 我尝试了设置每隔5分钟运行一次,发现青龙面板会每次启动一个实例。

Suggested solution

Add a field to schedules, define it as daemon. Qionglong checks the schedule follow crontab definition. If it's running, stop and quit. if not, run it.

给计划任务添加一个属性:是否为守护进程。 按照计划任务定义的时间间隔,青龙面板检查进程是否仍在执行。如果是则不再启动新进程;如果进程已经停止,则启动进程。

Alternative

Now I designed a counter, refresh the running information and store it to config file. Therefore everytime when Qionglong trying to create a new instance, the new instance will check config file first. If there is already one running, quit. or keep running.

目前设计了一个运行计数器,每次更新后把结果保存到配置文件中。这样当每次青龙面板试图创建新进程的时候,新进程首先检查配置文件,如果计数器仍在工作,则自动退出新进程,否则启动新进程。

Additional context

I checked other issues, some people have similar requirement. So I think we can add some more fields to define a schedule instead of "run as daemon":

If last schedule is still running:

  1. Kill last schedule and run new one
  2. Ignore it and run new one
  3. Just quit.

我看了别的问题,发现一些类似需求。我觉得可以通过在创建计划时候添加一个选项把这些需求合并起来:

如果上一个计划仍在运行:

  1. 先停止上一个计划再运行
  2. 直接运行
  3. 直接退出

这样我们就不需要把计划标记为守护进程了。

Validations

  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

ErixWong avatar Oct 08 '23 04:10 ErixWong

if tor does not support no auth in socks5 would it not be a bug in our socks5 client dep? it should send back an error like "proxy refused request, authorization type [placeholder values goes here] not supported" if we are talking to a socks5 proxy that does not accept anon socks5 request.

majestrate avatar Apr 06 '23 11:04 majestrate

But it works from Firefox without credentials. Should work from Yggdrasil, no?

Revertron avatar Apr 06 '23 11:04 Revertron

On Thu, 06 Apr 2023 04:52:33 -0700 Revertron @.***> wrote:

But it works from Firefox without credentials. Should work from Yggdrasil, no?

it may be that firefox will try to use empty user/pass if it rejects anon socks5, which would be rich af to see other people work around shitty bugs like this.

-- ~jeff

majestrate avatar Apr 06 '23 11:04 majestrate

Maybe you want to try setting SocksPort 9050 PreferSOCKSNoAuth in torrc.

Vort avatar Apr 18 '23 15:04 Vort

Also I2P connections stopped working with error: Failed to dial SOCKS localhost:4449: socks connect tcp localhost:4449->xmgzqfidm3zn4y3vfljqiuyfxorifntjca3rfnwv3dbbfcrx4uca.b32.i2p:30112: EOF. Tor and I2P connections worked fine for 0.4.4. It seems there was a refactoring from 0.4.4 to 0.4.5 which borked the socks connections.

0Flag avatar May 02 '23 09:05 0Flag

I2P network is under attack now by the way. Not sure if it is related to proxy problem however.

Vort avatar May 02 '23 09:05 Vort

I2P network is under attack now by the way. Not sure if it is related to proxy problem however.

True, but that's not the issue. I can connect to I2P peers right now with V 0.4.4

0Flag avatar May 02 '23 09:05 0Flag

Is this still an issue?

neilalexander avatar Oct 21 '23 20:10 neilalexander

Is this still an issue?

Yes.

add: users say sockstls solves that issue.

r4sas avatar Nov 07 '23 16:11 r4sas