-
Notifications
You must be signed in to change notification settings - Fork 309
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
V2P定时任务-使用Shell指令执行任务问题 #94
Comments
定时任务的 Shell 指令默认 timeout 为 60 秒。 $exec('node xxx.js', {
cwd: 'script/JSFile', timeout: 0,
cb(data, error){
error ? console.error(error) : console.log(data)
}
} 另外,原来的shell 指令也可以写为: node xxx.js -cwd script/JSFile |
@elecV2 谢谢,我现在去试试:) |
参照了JS的文档https://github.com/elecV2/elecV2P-dei/blob/master/docs/04-JS.md
另外不知道env可不可以用$store来获取cookie值,如下这样:
|
3.4.0 及之前的版本使用 env 会缺少默认的环境变量 path 等。 // @grant nodejs (首行添加这句
$exec('node xxx.js', {
env: {
...process.env, // env 中添加这句,其他保持不变
jc: '你的其他 env 变量'
}
}) 或者直接升级到 v3.4.1。 可以使用 $store |
@elecV2 好的 我现在更新并修改试试,谢谢 |
大佬,新版的v2p增加node运行的timeout选项了吗?没找到,昨天运行了一下,还是6s结束啊 |
这样,node https://raw.githubusercontent.com/***.js -timeout=0 |
非常感谢 |
由于最近某APP的验证机制,这几天该定时任务尝试使用Shell指令来执行node指令:
node /usr/local/app/script/JSFile/jd_joy_new.js
今天发现任务并没有执行完毕,而是在执行第三个账号就直接断开finished...上网搜索问题之后,猜想可能是使用指令执行没有进程守护,可能是导致任务直接跳出断开的原因...
由于学习相关知识可能需要花费挺长的时间,所以想直接请教怎么解决这个问题...
麻烦了,谢谢...
The text was updated successfully, but these errors were encountered: