用P4运行crontab作业

2024-05-14 21:12:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个shell脚本,它反过来调用python脚本。但是在python脚本运行之前,我要设置环境变量,以获得正确的P4配置。在

shell: /home/ag/ump_prod/run.sh
python script: /home/ag/ump_prod/cron.py
Environment conf: /home/ag/ump_prod/env.conf

python脚本通过subprocess模块执行命令行P4命令。 下面是shell脚本的代码

^{pr2}$

在环境确认在

^{3}$

perforce config/home/ag/ump_prod/.perforce:

P4CLIENT=ag_ump
P4EDITOR=/usr/bin/vim
P4PORT=rsh:ssh -2 -q -a -x -l p4server p4.****.com /bin/true
P4USER=ag

手动运行shell脚本可以毫无问题地执行它。 但是,当我通过cronjob运行它时,它会抱怨它无法连接到服务器。在

错误消息:

['TCP receive failed.\n', 'read: socket stdio: Connection reset by peer\n', 'Perforce client error:\n', '\tTCP receive failed.\n', '\tread: socket stdio: Connection reset by peer\n']

请告诉我在为P4配置设置环境变量时可能出错的地方。提前谢谢!在


Tags: 脚本homebinconf环境变量prodsocketshell

热门问题