nohup java -jar x.jar >/dev/null 2>&1 &
这串代码放宝塔的计划任务启动失败,但是SSH登录终端执行代码就是正常的,请大佬赐教,谢谢!
热议
推荐楼 发财 4小时前
path of x.jar
cd www
nohup java -jar path of x.jar >/dev/null 2>&1 &
和
cd www
path of x.jar
nohup java -jar x.jar >/dev/null 2>&1 &
都失败啊
2楼 HOH 16小时前
path of x.jar
3楼 require 15小时前
楼上正解,写全路径就行了
4楼 Akewa 8小时前
java -jar x.jar >/var/log/why.log 2>&1
看why告诉你
6楼 发财 4小时前
java -jar x.jar >/var/log/why.log 2>&1
看why告诉你
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ ____ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/___)| |_)| | | | | || (_| |) ) ) )
'|____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2022-09-04 04:09:21.605INFO 807875 --- [ main] com.gkc : Starting TrxApplication v1.0 with PID 807875 (/www/x.jar started by root in /www)
2022-09-04 04:09:21.611INFO 807875 --- [ main] com.gkc : No active profile set, falling back to default profiles: default
2022-09-04 04:09:21.793INFO 807875 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@255316f2: startup date [Sun Sep 04 04:09:21 EDT 2022]; root of context hierarchy
2022-09-04 04:09:24.390INFO 807875 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2022-09-04 04:09:25.432INFO 807875 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 1111 (http)
2022-09-04 04:09:25.452INFO 807875 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2022-09-04 04:09:25.453INFO 807875 --- [ main] org.apache.catalina.core.StandardEngine: Starting Servlet Engine: Apache Tomcat/8.5.14
2022-09-04 04:09:25.601INFO 807875 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-09-04 04:09:25.601INFO 807875 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3822 ms
2022-09-04 04:09:25.799INFO 807875 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean: Mapping servlet: 'dispatcherServlet' to [/]2022-09-04 04:09:25.806INFO 807875 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]2022-09-04 04:09:25.807INFO 807875 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]2022-09-04 04:09:25.807INFO 807875 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]2022-09-04 04:09:25.807INFO 807875 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]2022-09-04 04:09:26.297INFO 807875 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@255316f2: startup date [Sun Sep 04 04:09:21 EDT 2022]; root of context hierarchy
7楼 js攻城狮 4小时前
这不是启动了吗
8楼 发财 3小时前
这不是启动了吗
没有启动,日志是我用ssh登录终端执行代码获取的
9楼 小米八宝茶 3小时前
nohup java -jar -Dspring.profiles.active=prod /file/xxx.jar >>/file/xxx.log 2>&1 &
10楼 iiss 3小时前
要把错误日志发出来,有可能是环境变量的原因。
12楼 发财 3小时前
nohup java -jar -Dspring.profiles.active=prod /file/xxx.jar >>/file/xxx.log 2>&1 &
还是一样的,ssh登录终端可以使用,宝塔的计划任务就无法使用
13楼 发财 3小时前
要把错误日志发出来,有可能是环境变量的原因。
Usage:
kill [options] <pid> [...]
Options:
<pid> [...] send signal to every <pid> listed
-<signal>, -s, --signal <signal>
specify the <signal> to be sent
-q, --queue <value> integer value to be sent with the signal
-l, --list=[<signal>]list all signal names, or convert one to a name
-L, --table list all signal names in a nice table
-h, --help display this help and exit
-V, --versionoutput version information and exit
For more details see kill(1).
----------------------------------------------------------------------------
★[2022-09-04 04:59:26] Successful
----------------------------------------------------------------------------
14楼 mlc 2小时前
定时任务直接调应该没有环境,写到脚本里再定时调用
15楼 发财 2小时前
定时任务直接调应该没有环境,写到脚本里再定时调用
大佬,只能发一下怎么写吗?用宝塔的菜鸡,不懂啊
16楼 Akewa 2小时前
不是宝塔跑不起来吗
我是让你把
nohup java -jar x.jar >/var/log/why.log 2>&1 &
加到宝塔任务里,让宝塔执行一次
再看why里日志
17楼 iiss 2小时前
Usage:
kill [options][...]
可以联系我签名tg我帮你看看,你这个不是错误日志,你给的不对。
18楼 js攻城狮 2小时前
不是宝塔跑不起来吗
我是让你把
寄,楼主看不懂什么叫控制变量法
19楼 mlc 半小时前
大佬,只能发一下怎么写吗?用宝塔的菜鸡,不懂啊
参考一下这个就可以了,后面cron定时表达式只要后面的命令写在宝塔的定时任务里面就行了
https://blog.csdn.net/u011418530/article/details/83104193
20楼 云缨 半小时前
用绝对路径避免环境变量的问题
申明:本文内容由网友收集分享,仅供学习参考使用。如文中内容侵犯到您的利益,请在文章下方留言,本站会第一时间进行处理。