该脚本是从终端运行的,但不是从 crontab 运行的。我得到的脚本代码和错误如下所示:
脚本
#!/usr/bin/python
import subprocess
subprocess.call(['touch','yahoo.txt'])
来自 Crontab 邮件的错误
From root@vps.server.com Mon Jul 22 21:10:05 2013
Return-Path: <root@vps.server.com>
Received: from vps.server.com (localhost [127.0.0.1])
by vps.server.com (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id r6MHA3ll002017
for <root@vps.server.com>; Mon, 22 Jul 2013 21:10:03 +0400
Received: (from root@localhost)
by vps.server.com (8.14.4/8.14.4/Submit) id r6MHA1sr002016
for root; Mon, 22 Jul 2013 21:10:01 +0400
Date: Mon, 22 Jul 2013 21:10:01 +0400
Message-Id: <201307221710.r6MHA1sr002016@vps.server.com>
From: root@vps.server.com (Cron Daemon)
To: root@vps.server.com
Subject: Cron <root@vps> cd /root/; python mkdir.py
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
': [Errno 2] No such file or directory