使用Hortonworks 的twitter tutorial: http://hortonworks.com/hadoop-tutorial/how-to-refine-and-visualize-sentiment-data/

老是失败,所以查看收到的邮件,发现了一些错误。
重复的出现:
X-Cron-Env: <USER=hue>
Message-Id: <20131212042503.CE5AAA109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:25:03 -0800 (PST)

Traceback (most recent call last):
  File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
    do_post()
  File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
    os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration'

不知道,怎么修改。。

From root@sandbox.hortonworks.com  Wed Dec 11 20:30:03 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 49869A109E; Wed, 11 Dec 2013 20:30:03 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212043003.49869A109E@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:30:03 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' You have mail in /var/spool/mail/root
[root@sandbox mail]# vim root From root@sandbox.hortonworks.com Wed Dec 11 19:25:33 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id CF8EEA109B; Wed, 11 Dec 2013 19:25:26 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212032527.CF8EEA109B@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 19:25:26 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 19:30:30 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 22C3FA109A; Wed, 11 Dec 2013 19:30:27 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212033028.22C3FA109A@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 19:30:27 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 19:36:43 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id DABBCA109D; Wed, 11 Dec 2013 19:36:04 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212033639.DABBCA109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 19:35:57 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 19:41:06 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 9539FA109A; Wed, 11 Dec 2013 19:40:46 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212034102.9539FA109A@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 19:40:46 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:04:14 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 50732A109D; Wed, 11 Dec 2013 20:01:28 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212040408.50732A109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:01:15 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:04:14 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 50519A109F; Wed, 11 Dec 2013 20:01:28 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212040412.50519A109F@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:01:14 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:04:15 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id C43DFA109E; Wed, 11 Dec 2013 20:01:28 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212040412.C43DFA109E@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:01:14 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:05:02 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id B4C55A109D; Wed, 11 Dec 2013 20:05:01 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212040502.B4C55A109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:05:01 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:10:06 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 3F50BA109D; Wed, 11 Dec 2013 20:10:05 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212041006.3F50BA109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:10:05 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:15:03 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id E2CFDA109D; Wed, 11 Dec 2013 20:15:02 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212041502.E2CFDA109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:15:02 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:20:02 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 8B31AA109D; Wed, 11 Dec 2013 20:20:02 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212042002.8B31AA109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:20:02 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:25:04 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id CE5AAA109D; Wed, 11 Dec 2013 20:25:03 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212042503.CE5AAA109D@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:25:03 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:30:03 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 49869A109E; Wed, 11 Dec 2013 20:30:03 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212043003.49869A109E@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:30:03 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration' From root@sandbox.hortonworks.com Wed Dec 11 20:35:04 2013
Return-Path: <root@sandbox.hortonworks.com>
X-Original-To: root
Delivered-To: root@sandbox.hortonworks.com
Received: by sandbox.hortonworks.com (Postfix, from userid 1007)
id 7B144A109E; Wed, 11 Dec 2013 20:35:04 -0800 (PST)
From: root@sandbox.hortonworks.com (Cron Daemon)
To: root@sandbox.hortonworks.com
Subject: Cron <hue@sandbox> /usr/lib/tutorials/.env/bin/python /usr/lib/hue/tools/start_scripts/registration_post.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=hue>
X-Cron-Env: <USER=hue>
Message-Id: <20131212043504.7B144A109E@sandbox.hortonworks.com>
Date: Wed, 11 Dec 2013 20:35:04 -0800 (PST) Traceback (most recent call last):
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 53, in <module>
do_post()
File "/usr/lib/hue/tools/start_scripts/registration_post.py", line 49, in do_post
os.remove(CRON_FILE)
OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration'

查看:"/usr/lib/hue/tools/start_scripts/registration_post.py

import os
import pwd, grp
from datetime import datetime USERINFO_FILE_PATH = os.path.join('/usr/lib/tutorials',
'user_info.dat')
MARKETO_URL = "http://info.hortonworks.com/index.php/leadCapture/save"
CRON_FILE = "/etc/cron.d/1sandbox_registration"
CRON_FILE_ORIGIN = "/usr/lib/hue/tools/start_scripts/registration_post_cron" LOG_FILE = "/usr/lib/tutorials/registration_post.log" def do_post():
with file(LOG_FILE, "a+") as LOG: def log(s):
print >>LOG, "[%s] %s" % (datetime.now().strftime("%d_%m_%Y_%H-%M-%S"), s)
LOG.flush() if os.path.exists(USERINFO_FILE_PATH):
#DO post
"registration_post.py" 56L, 1889C 1,1 Top
import os
import pwd, grp
from datetime import datetime USERINFO_FILE_PATH = os.path.join('/usr/lib/tutorials',
'user_info.dat')
MARKETO_URL = "http://info.hortonworks.com/index.php/leadCapture/save"
CRON_FILE = "/etc/cron.d/1sandbox_registration"
CRON_FILE_ORIGIN = "/usr/lib/hue/tools/start_scripts/registration_post_cron" LOG_FILE = "/usr/lib/tutorials/registration_post.log" def do_post():
with file(LOG_FILE, "a+") as LOG: def log(s):
print >>LOG, "[%s] %s" % (datetime.now().strftime("%d_%m_%Y_%H-%M-%S"), s)
LOG.flush() if os.path.exists(USERINFO_FILE_PATH):
#DO post
log("Try to upload...")
import urllib2 data = file(USERINFO_FILE_PATH).read() request = urllib2.Request(MARKETO_URL)
request.data = data
try:
res = urllib2.urlopen(request)
except:
log("Failed to upload.")
else:
log("Uploaded successful. Code: %s %s\n%s\n\nheaders: %s" %\
(res.code, res.msg, res.read(), res.headers.dict))
os.rename(USERINFO_FILE_PATH, USERINFO_FILE_PATH + ".posted") elif not os.path.exists(USERINFO_FILE_PATH + ".posted"):
#Not registered yet. Add script to cron
if not os.path.exists(CRON_FILE):
with file(CRON_FILE, "w") as f:
f.write(file(CRON_FILE_ORIGIN).read())
log("Script added to cron") else:
#Registered. Remove cron task
if os.path.exists(CRON_FILE):
os.remove(CRON_FILE)
log("Script removed from crontab") if __name__ == '__main__':
do_post()
uid = pwd.getpwnam('hue').pw_uid
gid = grp.getgrnam('hadoop').gr_gid
os.chown(LOG_FILE, uid, gid)

OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration'的更多相关文章

  1. nova-compute[5410]: OSError: [Errno 13] Permission denied: &#39;图像路径&#39;

    前几天有 openstack-Nova 创建虚拟机拨弄了一下,结果重新启动后的今天 nova boot 创建虚拟机实例有错误,创建虚拟机出状况  他们是 error 视图 openstack 服务状态 ...

  2. OSError:[Errno 13] Permission denied:'my_library' 问题解决方法

    出现问题: 执行 rosrun rosserial_windows make_libraries.py my_library 命令时出现OSError:[Errno 13] Permission de ...

  3. mac下载模块时报错OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/chardet'

    原文地址:https://www.cnblogs.com/liangyan-1989/p/8143129.html 安装完pip后,使用pip install selenium报以下错 OSError ...

  4. OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django'

    http://blog.csdn.net/qq_34078897/article/details/50821553 权限问题,sudo

  5. Python UDP broadcast PermissionError: [Errno 13] Permission denied

    /********************************************************************** * Python UDP broadcast Permi ...

  6. sendto() 向广播地址发包返回errno 13, Permission denied错误

    http://blog.csdn.net/guanghua2_0beta/article/details/52483916 sendto() 向广播地址发包返回errno 13, Permission ...

  7. 如何解决 Django中出现的 [Errno 13] Permission denied问题

    环境:linux 如果你使用了Apache部署了Django项目,在上传文件时可能会出现 “[Errno 13] Permission denied:某目录”的错误. 这是因为apache没有权限在该 ...

  8. windows python flask上传文件出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads'的解决方法

    在浏览器中输入时,出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads' http://127.0.0.1: ...

  9. 报错:/usr/sbin/mysqld: Can't find file: './performance_schema/events_waits_summary_by_account_by_event_name.frm' (errno: 13 - Permission denied)

    报错背景: Linux环境下安装MySQL数据库. 安装完成,数据库初始化,启动数据库时报错. 报错现象: -- :: [ERROR] Native table 'performance_schema ...

随机推荐

  1. 要将程序集“xxx.dll”标记为系统必备组件,必须对其进行强签名

    最近编译经常偶尔出现标题这个错误,有时重启电脑,就正常了,有时重启也不行,真蛋疼,后来发现把dll预先拷贝到生成目录,也可以避免这个编译错误,但是实在是麻烦,再去Google了半天,终于找到了解决方案 ...

  2. OD调试3--reverseMe

    OD调试3:reverseMe.exe(reverse就是逆向的意思) 运行效果图: 1关于寄存器 寄存器就好比是CPU身上的口袋,方便CPU随时从里边拿出需要的东西来使用.今天的程序中涉及到九个寄存 ...

  3. 拥有iframe页面的子父类窗口调用JS的方法,并且注意的事项

    一.前言 我页面用的是EasyUI的弹出窗口里面嵌入一个iframe.第一:父窗口打开子窗口是一个新增用户信息的iframe子页面,点击保存后,子窗口iframe则去调用父窗口的function cl ...

  4. linux android ndk

    Android调用so库, so库是c语言编写, 在linux 64位系统+ndk(32位)生成 lib*.so (32位) 1. 所需软件环境: 1)so库开发环境 操作系统: Redhat Ser ...

  5. 一种无new创建对象的方法

    var L=function(){ var obj = { age:38, live:true, job:"web dev" }; obj.name = "zhouhui ...

  6. Scrapinghub执行spider抓取并显示图片

    序 最近在学习Scrapy的时候发现一个很有意思的网站,可以托管Spider,也可以设置定时抓取的任务,相当方便.于是研究了一下,把其中比较有意思的功能分享一下: 抓取图片并显示在item里: 下面来 ...

  7. PHP中__autoload()的不解之处,求高手指点

    一整段代码: 运行结果: 使用__autoload(),分为两页代码: 第一段代码: ACMEManager.php,代码如下: 运行结果:

  8. 【其他】IT公司的企业文化与竞争力

    一直觉得三流企业靠成本竞争,二流企业靠体制竞争,一流企业靠文化竞争. 企业在竞争时候,总会提到一个词:核心竞争力.对于IT企业来说,核心竞争是什么?无论是技术也好,销售也罢,归根到底还是人才的竞争,优 ...

  9. USB匹配电阻

    做过USB的人都或许有一个纠结,那就是D+和D-上到底要串多大的电阻,串在源端还是终端. 我想说:网络上的说法都不完全正确,首先USB有低速.全速和高速之分,在低速和全速模式下是电压驱动的,驱动电压为 ...

  10. MSP430F149模拟IIC读写24C02程序

    板子上设置了EEPROM存储器,型号为AT24C02.板子的硬件连接为:SCL--->P2.4,SDA--->P2.5.直接了当,贴上程序! ======================= ...