summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commonnet/scrapy_setting.py2
-rw-r--r--conf/scrapy.logrotate10
-rwxr-xr-xinstall.sh2
3 files changed, 14 insertions, 0 deletions
diff --git a/commonnet/scrapy_setting.py b/commonnet/scrapy_setting.py
index 0d0f15b..31bba15 100644
--- a/commonnet/scrapy_setting.py
+++ b/commonnet/scrapy_setting.py
@@ -29,6 +29,8 @@ SCRAPPY_SETTINGS = {
# Disable Telnet Console (enabled by default)
"TELNETCONSOLE_ENABLED": False,
+ "LOG_FILE": "/var/log/scrapy/commonnet.log",
+
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
diff --git a/conf/scrapy.logrotate b/conf/scrapy.logrotate
new file mode 100644
index 0000000..54affd7
--- /dev/null
+++ b/conf/scrapy.logrotate
@@ -0,0 +1,10 @@
+"/var/log/scrapy/*.log" {
+ copytruncate
+ daily
+ rotate 5
+ compress
+ delaycompress
+ missingok
+ notifempty
+}
+
diff --git a/install.sh b/install.sh
index 0005cd2..7c1deeb 100755
--- a/install.sh
+++ b/install.sh
@@ -32,9 +32,11 @@ DB_NAME=commonnet
echo " * Creating conf files"
mkdir -p /var/log/django/
+mkdir -p /var/log/scrapy/
mkdir -p /var/lib/uwsgi/run
chown -R www-data:www-data /var/lib/uwsgi/run
chown -R www-data:www-data /var/log/django/
+cp conf/scrapy.logrotate /etc/logrotate.d/scrapy
sed -s "s|#URL#|$URL|g;s|#PASSWORD#|$PASSWORD|g;\
s|RESPONSIBLE_EMAIL = None|RESPONSIBLE_EMAIL = '$RESPONSIBLE_EMAIL'|;" \