复制代码

为懒人提供无限可能,生命不息,code不止

人类感性的情绪,让我们知难行难
我思故我在
日拱一卒,功不唐捐
  • 首页
  • 前端
  • 后台
  • 数据库
  • 运维
  • 资源下载
  • 实用工具
  • 接口文档工具
  • 登录
  • 注册

centOS

【原创】centos 系统 shell && python脚本手动可以执行,crontab 不执行原因

作者: whooyun发表于: 2018-12-29 01:38

写过很多次crontab 每次都是perfect 执行。

没想到这几天掉坑了,各种目录调整,权限检查,文件路径检查都没鬼用。

最后发现是centos系统参数问题,执行的时候必须source profile

1. sh脚本处理方法:

直接在脚本前面加上: source /etc/profile

2. python处理方法:
crontab -e 里必须刷新profile
source /etc/profile && python /opt/clearUserServerlog.py