惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News | PayPal Newsroom
Application and Cybersecurity Blog
Application and Cybersecurity Blog
O
OpenAI News
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Latest news
Latest news
NISL@THU
NISL@THU
S
Security Affairs
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
AI
AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AWS News Blog
AWS News Blog
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
I
InfoQ
Schneier on Security
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
IT之家
IT之家
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
L
LINUX DO - 最新话题
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
H
Heimdal Security Blog
S
SegmentFault 最新的问题

邢平cn's blog

甲骨文密钥 ssh 连不上且忘记登录密码解决方法 让 traefik 代替你的 waf(使用 CrowdSec)+ nginx + acme.sh + mtls-auth 使用 rclone 和 alist 加密和备份你的数据到公有云 邓晓芒《黑格尔辩证法讲演录》读书笔记 如何白嫖和使用 GitHub models 的 LLM(gpt4o 和 Llama-3.1-405b) 提升部署在 cloudflare、vercel 或 netlify 的网站在中国国内的访问速度和稳定性 免费通过 NS1 利用监控宝平台实现实时基于不同运营商的故障转移 记录某一测速网站的 js 逆向的过程 列举几个免费域名和权威 dns 服务器 Hexo 博客折腾 docker 学习笔记 尝试在闲置的 surface pro 4 上运行安卓应用 国内各个 as 自治系统[转] 『现学现忘』Git基础 — 19、在Git中进行忽略文件操作 让在 vpc 中的 aws lambda 函数不通过 nat 获得访问互联网的能力 curl 遇到的坑 你的常用域名被其他 vercel 账号使用的解决方法 解决升级 umamiv2.11 时出现的 P3009 错误 v2ray+ws+tls 太慢解决方法 在 python 中运行 bash 实时输出结果(windows) 在存在父子文件结构情况下使用 python import
cron 笔记
xingpingcn · 2023-04-01 · via 邢平cn's blog

cron 笔记,包含 cron 不执行 shell 脚本的解决办法

cron 笔记,包含 cron 不执行 shell 脚本的解决办法

也许 shell 脚本本身可以执行,但是 cron 中不能执行,需要像下面这样设置

cron-for-run-per-1h.cron

SHELL=/bin/bash

0 * * * * . /etc/profile;/bin/sh /pathto/run.sh

Note (NOTE)

最后一定要有一个回车!后者会导入失败

run.sh

#!/bin/bash

PATH=/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

LOGS_FILE="/pathto/logs/$(date "+%Y-%m-%d-%H-%M-%S").log"

cd /pathto

docker-compose up >> $LOGS_FILE 2>&1

最后设置到 cron

run.sh

crontab /pathto/cron-for-run-per-1h.cron

Warning (warning)

使用此命令会覆盖之前所有的 cron 任务

如果你不想覆盖之前的,那么就 /etc/cron.d 中新建文件,然后写进去。

Warning (warning)

cron 的话基本必有一个 ?,它仅可存在于 dayofmouth 或者 dayofweek

个人 docker 配置备份

Dockerfile

FROM python:3.11

WORKDIR /bin/test

COPY ./requirements.txt ./

RUN pip install -r ./requirements.txt

ENTRYPOINT [ "python" ]

CMD [ "./test.py" ]

docker-compose.yml

version: '3.8'

services:

enhanced-faas:

build:

context: ./

container_name: enhanced-faas

volumes:

- './:/bin/test'

expose:

- 443,80

command: ./main.py

networks:

- nginx-proxy

networks:

nginx-proxy:

external: true

评论