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

推荐订阅源

博客园 - 【当耐特】
WordPress大学
WordPress大学
T
The Exploit Database - CXSecurity.com
博客园_首页
MyScale Blog
MyScale Blog
The Cloudflare Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
F
Full Disclosure
V
V2EX
博客园 - Franky
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
SecWiki News
SecWiki News
N
Netflix TechBlog - Medium
S
Secure Thoughts
酷 壳 – CoolShell
酷 壳 – CoolShell
Hacker News: Ask HN
Hacker News: Ask HN
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Martin Fowler
Martin Fowler
PCI Perspectives
PCI Perspectives
S
Security @ Cisco Blogs
Recorded Future
Recorded Future
Help Net Security
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
AI
AI
Microsoft Azure Blog
Microsoft Azure Blog
K
Kaspersky official blog
G
GRAHAM CLULEY
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
CERT Recently Published Vulnerability Notes
U
Unit 42
T
Tor Project blog
Cloudbric
Cloudbric
Hacker News - Newest:
Hacker News - Newest: "LLM"
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
Security Latest
Security Latest
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

邢平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

评论