简体   繁体   中英

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: |./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. I tried adding echo statements around the python command but they did not print either. Essentially I want to receive email, do some word processing to it, and then call a python program from that same script.

I tried creating an intermediary script that simply calls the python program. 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. For example, try

python /path/to/addToStorage.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM