Linux随记(八)

一、crontab运行shell脚本,py脚本 (注意事项)

shell 复制代码
情景描述:
目前有个sh脚本他最初大致内容是。
cat t11.sh

#!/bin/bash
source /etc/profile 

/bin/python3  /tmp/1.py
sh             /tmp/1.sh
echo -e "$(date +%F)" >> /tmp/t11.log

############问题是
crontab调用他, 为啥py脚本没执行?     手动 sh t11.sh是正常执行的。
crontab | grep t11 是能看到每次的执行记录的

#排查思路:
1、都使用绝对路径  (指令写绝对路径) (shell/py 代码内容,涉及文件的操作)  他默认的pwd是在执行用户的家目录
2、都给x可执行权限
3、开头 source /etc/profile
4、crontab 写查看调试日志,比如   * * * * * sh /tmp/11.sh > /tmp/11.log 2>&1   (最初没考虑到py脚本内容的绝路路径。注意Py脚本里面try catch的书写)

5、使用set -x , echo $? , sh -x  xxx.sh排查



5、创建一个简单的py程序,将hello world 输出到个record.txt

二、bclinux欧拉21.10编译安装nginx1.24.0

shell 复制代码
yum -y install gcc gcc-c++  pcre pcre-devel  openssl openssl-devel  zlib zlib-devel
yum install gd-devel -y

cd /DATA/apps
mkdir -p tools-nginx-1.24

rz -bey    #上传nginx-1.24.0.tar.gz       (wget https://nginx.org/download/nginx-1.24.0.tar.gz)

tar -xf nginx-1.24.0.tar.gz
cd nginx-1.24.0


./configure  --prefix=/DATA/apps/tools-nginx-1.24 --with-pcre --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_image_filter_module --with-mail --with-threads --with-mail_ssl_module --with-stream_ssl_module


make -j 4 && make install 

#
cd /DATA/apps/tools-nginx-1.24/conf
mkdir -p vhost

vi nginx.conf
修改
user root;
worker_processes  8;
#在http{}块里加入
    include       vhost/*.conf; 
	
	
	
#启动ngx
cd /DATA/apps/tools-nginx-1.24/sbin  && ./nginx -t   && ./nginx
相关推荐
生万千欢喜心7 分钟前
liunx AnolisOS-8.9-x86_64-dvd.iso win11 适配龙蜥 - 虚拟机
linux
2601_962341301 小时前
计算机毕业设计之jsp考研在线复习平台
java·大数据·开发语言·hadoop·python·考研·课程设计
Qimooidea1 小时前
祁木 CAD Translator 全套功能 & 官网入口汇总
运维·服务器
天空'之城1 小时前
Linux 系统编程 12:TCP 进阶
linux·网络编程
云烟成雨TD1 小时前
LangFlow 1.x 系列【7】工作流创建与部署指南
人工智能·python·agent
梦想的颜色1 小时前
Docker 容器化本地部署 Claude Code 完整硬核教程|隔离沙盒 + 国产模型直连 + 持久化 Skill
运维·容器·ai 工程化·沙盒隔离·docker 本地部署·claude code硬核实战·国内国产模型接入
bkspiderx2 小时前
rpath:Linux 中固定共享库搜索路径的“永久解决方案”
linux·rpath·固定共享库搜索路径
月疯2 小时前
np.where()[0]的用法
开发语言·python·numpy
wbs_scy2 小时前
仿 muduo 高并发服务器项目:从 timerfd 到时间轮实现定时任务机制
linux·服务器·c++
AI的探索之旅2 小时前
从 Ubuntu 14.04 到 24.04:TI AM335x 开发环境完整迁移与 Agent 接管方案
linux·数据库·嵌入式硬件·ubuntu·postgresql