Jenkins Linux远程执行shell有以下命令:
npm run develop
但是,该命令不会返回到终端,如下所示:
+ npm run develop
> sggs-api@0.1.0 develop
> strapi develop
Project information
[90m┌────────────────────[39m[90m┬──────────────────────────────────────────────────┐[39m
[90m│[39m Time [90m│[39m Tue Oct 04 2022 10:02:58 GMT+0000 (Coordinated … [90m│[39m
[90m│[39m Launched in [90m│[39m 1201 ms [90m│[39m
[90m│[39m Environment [90m│[39m development [90m│[39m
[90m│[39m Process PID [90m│[39m 422222 [90m│[39m
[90m│[39m Version [90m│[39m 4.2.3 (node v16.17.0) [90m│[39m
[90m│[39m Edition [90m│[39m Community [90m│[39m
[90m└────────────────────[39m[90m┴──────────────────────────────────────────────────┘[39m
Actions available
Welcome back!
To manage your project 🚀, go to the administration panel at:
http://localhost:1337/admin
To access the server ⚡️, go to:
http://localhost:1337
我可以把它放在下面的背景中:
nohup npm run develop &
但是,我需要帮助来确定nohup npm run develop &
命令是否成功。
nohup npm run develop > /dev/null 2>&1 &
此命令也不起作用。
根据建议,我尝试了以下方法:
#echo "nohup npm run develop &"
#nohup npm run develop &
#npm run develop > /dev/null 2>&1 &
#BUILD_ID=dontKillMe nohup npm run develop &
export BUILD_ID=dontKillMe
export JENKINS_SERVER_COOKIE=dontKillMe
nohup npm run develop &
我尝试了那些用#
和评论的,但没有成功
这个过程开始了,过了一段时间就消失了。
以下是输出:
+ pwd
/etc/jenkins_tmp/workspace/SGGS_QA_API
+ export BUILD_ID=dontKillMe
+ BUILD_ID=dontKillMe
+ export JENKINS_SERVER_COOKIE=dontKillMe
+ JENKINS_SERVER_COOKIE=dontKillMe
+ '[' 0 -eq 0 ']'
+ echo 'npm run develop was successful. Copying ...'
npm run develop was successful. Copying ...
+ nohup npm run develop
> sggs-api@0.1.0 develop
> strapi develop
Project information
[90m┌────────────────────[39m[90m┬──────────────────────────────────────────────────┐[39m
[90m│[39m Time [90m│[39m Tue Oct 04 2022 12:17:19 GMT+0000 (Coordinated … [90m│[39m
[90m│[39m Launched in [90m│[39m 808 ms [90m│[39m
[90m│[39m Environment [90m│[39m development [90m│[39m
[90m│[39m Process PID [90m│[39m 424441 [90m│[39m
[90m│[39m Version [90m│[39m 4.2.3 (node v16.17.0) [90m│[39m
[90m│[39m Edition [90m│[39m Community [90m│[39m
[90m└────────────────────[39m[90m┴──────────────────────────────────────────────────┘[39m
Actions available
Welcome back!
To manage your project 🚀, go to the administration panel at:
http://localhost:1337/admin
To access the server ⚡️, go to:
http://localhost:1337
[2022-10-04 12:17:23.707] [32mhttp[39m: POST /admin/login (110 ms) 200
[2022-10-04 12:17:23.895] [32mhttp[39m: GET /admin/7814.ec45b22f.chunk.js (7 ms) 200
[2022-10-04 12:17:24.101] [32mhttp[39m: GET /admin/1362.b73aabfc.chunk.js (1 ms) 200
[2022-10-04 12:17:24.109] [32mhttp[39m: GET /admin/Admin-authenticatedApp.7216e34f.chunk.js (1 ms) 200
[2022-10-04 12:17:25.520] [32mhttp[39m: GET /admin/information (27 ms) 200
[2022-10-04 12:17:25.539] [32mhttp[39m: GET /admin/users/me (39 ms) 200
[2022-10-04 12:17:25.544] [32mhttp[39m: GET /admin/users/me/permissions (46 ms) 200
[2022-10-04 12:17:25.713] [32mhttp[39m: GET /i18n/locales (14 ms) 200
[2022-10-04 12:17:25.920] [32mhttp[39m: GET /admin/Admin_homePage.254acc19.chunk.js (1 ms) 200
[2022-10-04 12:17:26.144] [32mhttp[39m: GET /content-manager/components (13 ms) 200
[2022-10-04 12:17:26.159] [32mhttp[39m: GET /content-manager/content-types (25 ms) 200
Process leaked file descriptors. See https://www.jenkins.io/redirect/troubleshooting/process-leaked-file-descriptors for more information
Finished: SUCCESS
你能提出建议吗?
在jenkins中唯一适用于npm run develop
的解决方案是nohup npm run develop >> /var/www/logs/strapi.log 2>&1 &