我有一個(gè)作為服務(wù)自動(dòng)啟動(dòng)的 python 腳本(用 systemd 激活)。在這個(gè) python 腳本中,我使用 .bashrc 調(diào)用了一個(gè) bash 腳本subprocess.call(script_file,shell=True)。當(dāng)我手動(dòng)調(diào)用 python 腳本 ( $ python my_python_script.py) 時(shí),一切正常。但是,自動(dòng)啟動(dòng)的程序不執(zhí)行 bash 腳本(但是它確實(shí)運(yùn)行了,我檢查了這個(gè)我讓它編輯了一個(gè)文本文件,它確實(shí)這樣做了)。我(認(rèn)為)我給了每個(gè)人對(duì) bash 腳本的讀寫(xiě)權(quán)限。有沒(méi)有人對(duì)我做錯(cuò)了什么有想法?附錄:我想編寫(xiě)一個(gè)小腳本,通過(guò)電報(bào)向我發(fā)送我的公共 IP 地址。服務(wù)文件如下所示:[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
添加回答
舉報(bào)
0/150
提交
取消