为了账号安全,请及时绑定邮箱和手机立即绑定

作为服务运行时,Python 脚本未启动 Bash 脚本

作为服务运行时,Python 脚本未启动 Bash 脚本

手掌心 2021-06-11 14:15:59
我有一个作为服务自动启动的 python 脚本(用 systemd 激活)。在这个 python 脚本中,我使用 .bashrc 调用了一个 bash 脚本subprocess.call(script_file,shell=True)。当我手动调用 python 脚本 ( $ python my_python_script.py) 时,一切正常。但是,自动启动的程序不执行 bash 脚本(但是它确实运行了,我检查了这个我让它编辑了一个文本文件,它确实这样做了)。我(认为)我给了每个人对 bash 脚本的读写权限。有没有人对我做错了什么有想法?附录:我想编写一个小脚本,通过电报向我发送我的公共 IP 地址。服务文件如下所示:[Unit]Description=IPsenderAfter=networking.service[Service]Type=simpleUser=rootWorkingDirectory=/home/pi/projects/tg_botExecStart=/home/pi/miniconda3/bin/python /home/pi/projects/tg_bot/ip_sender_tg.pyRestart=always[Install]WantedBy=multi-user.target
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 135 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信