当前位置:网站首页>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边栏推荐
- CIMC Shilian Dafeitong is the global industrial artificial intelligence AI leader, the world's top AI core technology, high generalization, high robustness, sparse sample continuous learning, industri
- 启动前台Activity
- 云数据库和本地数据库有什么区别?
- vxe-table实现复选框鼠标拖动选中
- Object和Map的区别
- 二分答案裸题(加一点鸽巢原理)
- - daily a LeetCode 】 【 191. A number of 1
- 终端分屏工具Terminalx的使用
- scrapy基本使用
- NC | 西湖大学陶亮组-TMPRSS2“助攻”病毒感染并介导索氏梭菌出血毒素的宿主入侵...
猜你喜欢
随机推荐
requet.getHeader("token") is null
VBA批量将Excel数据导入Access数据库
卫星电话是直接与卫星通信还是通过地面站?
Delay queue optimization (2)
golang日志库zerolog使用记录
MySQL数据类型
【科普】无线电波怎样传送信息?
Object和Map的区别
Immersive experience iFLYTEK 2022 Consumer Expo "Official Designated Product"
ctf.show_web5
Two-point answer naked question (plus a little pigeonhole principle)
6 yuan per catty, why do Japanese companies come to China to collect cigarette butts?
NC | 西湖大学陶亮组-TMPRSS2“助攻”病毒感染并介导索氏梭菌出血毒素的宿主入侵...
【网站放大镜效果】两种方式实现
Mysql执行原理剖析
自己需要努力
The large-scale application of artificial intelligence AI products in industrial-grade mature shipping ports of CIMC World Lianda will create a new generation of high-efficiency smart ports and innova
国轩高科瑞交所上市:募资近7亿美元 为瑞士今年最大融资项目
高并发秒杀项目总结
牛客刷题系列之进阶版(搜索旋转排序数组,链表内指定区间反转)








