当前位置:网站首页>The problem of writing go run in crontab does not execute
The problem of writing go run in crontab does not execute
2022-07-30 19:02:00 【geekqian】
Use crontab to run the script regularly on the server, using the go run command, the result is not executed
Reference:
https://www.cnblogs.com/mysticbinary/p/13371189.html
http://www.nfangbian.com/go/cmd/gobuild.html
I searched and found that the go run command is only applicable to the debugging phase. If it is run on the server, it must be packaged into a binary file for execution.
Solution:
Executing the go build command in the project directory will generate an executable file with the file name of the project, and add the parameter -oYou can specify the packaged file name, as follows
go build -o appleIt may also be necessary to pay attention to whether there is a permission problem. If not, use chmod 755 xxx to escalate the privilege and execute it again.I'm using the root account so no problem.
Then write the direct executable file in crontab.
Post me:
1 0 * * * cd /work/xxx && ./apple边栏推荐
- Node encapsulates a console progress bar plugin
- OneFlow source code analysis: Op, Kernel and interpreter
- The use of terminal split screen tool Terminalx
- Chapter 14 Type Information
- MySQL data types
- VS Code 连接SQL Server
- Scrapy framework is introduced
- Anaconda Navigator卡在loading applications
- 积性函数
- [Prometheus] An optimization record of the Prometheus federation [continued]
猜你喜欢
随机推荐
Immersive experience iFLYTEK 2022 Consumer Expo "Official Designated Product"
跨进程启动后台服务
单例模式 (Singleton)
node封装一个控制台进度条插件
Object和Map的区别
Mysql执行原理剖析
crontab中写go run不执行的问题
在华为云,见证迷你世界的神奇觉醒
7.29模拟赛总结
OneFlow source code analysis: Op, Kernel and interpreter
运营 23 年,昔日“国内第一大电商网站”黄了...
尊重客观事实
第4章 控制执行流程
生物医学论文有何价值 论文中译英怎样翻译效果好
博纳影通过IPO注册:阿里腾讯是股东 受疫情冲击明显
AI Basics: Graphical Transformer
MongoDB打破了原则引入SQL?
Two-point answer naked question (plus a little pigeonhole principle)
NC | 西湖大学陶亮组-TMPRSS2“助攻”病毒感染并介导索氏梭菌出血毒素的宿主入侵...
[Prometheus] An optimization record of the Prometheus federation [continued]









