[英]How can I have my alias from a postfix server call a shell script that calls a python program?
When getting mail from user@something.com
, my /etc/aliases
file is setup like so: 从
user@something.com
邮件时,我的/etc/aliases
文件设置如下:
user: |./tmp/delivery
My delivery file looks like this: 我的交付文件如下所示:
echo "@" >> tmp/log
---some text processing---
python addToStorage.py
However, when I get an email, it runs every command in the delivery file except for the python
command. 但是,当我收到电子邮件时,它将运行传递文件中的所有命令,但
python
命令除外。 I tried adding echo
statements around the python
command but they did not print either. 我尝试在
python
命令周围添加echo
语句,但它们均未打印。 Essentially I want to receive email, do some word processing to it, and then call a python
program from that same script. 本质上,我想接收电子邮件,对其进行一些文字处理,然后从同一脚本调用
python
程序。
I tried creating an intermediary script that simply calls the python program. 我尝试创建一个仅调用python程序的中间脚本。 When running that script on its own, it works fine.
单独运行该脚本时,它可以正常运行。 But trying to call it from the delivery file still does not work.
但是尝试从传递文件中调用它仍然不起作用。
Make sure you give an absolute path to your python file. 确保您为python文件提供了绝对路径。 For example, try
例如,尝试
python /path/to/addToStorage.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.