简体   繁体   English

我如何从后缀服务器中获取我的别名,然后调用一个调用python程序的shell脚本?

[英]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.

相关问题 我可以使用别名从python脚本执行程序 - Can I use an alias to execute a program from a python script 如何在服务器上托管 function,我可以从我的 python 脚本调用它? - How do I host a function on a server, which I can call from my python script? 如何从我的 python 程序中调用智能合约? - how can I call smart contract from my python program? 如何中断调用 shell 脚本的 Python 程序? - How to interrupt a Python program which calls a shell script? 有没有办法让默认终端窗口从shell脚本中执行我的python程序? - Is there a way to have the default terminal window execute my python program from within shell script? 如何从嵌入式IPython Shell终止python程序? - How can I terminate a python program from an embedded IPython shell? 当我从shell脚本调用python文件时,如何获取带有路径的python文件的变量? - How can I get the variable that a python file with a path prints when I call that python file from a shell script? 如何在多进程中从python调用shell脚本? - How to call a shell script from python in multiprocess? 如何从 Python 异步调用 shell 脚本? - How to asynchronously call a shell script from Python? 如何从 python 代码调用 shell 脚本? - How to call a shell script from python code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM