From 1b9e6e4a344a845c2f1cebda0b631bfa3914f0dd Mon Sep 17 00:00:00 2001 From: Nicola Peditto Date: Thu, 18 May 2017 21:17:00 +0200 Subject: [PATCH] Added logrotate support --- docs/arduinoyun.md | 19 ++----------------- etc/logrotate.d/lightning-rod.log | 7 +++++++ 2 files changed, 9 insertions(+), 17 deletions(-) create mode 100644 etc/logrotate.d/lightning-rod.log diff --git a/docs/arduinoyun.md b/docs/arduinoyun.md index c8a5a23..68f87a8 100644 --- a/docs/arduinoyun.md +++ b/docs/arduinoyun.md @@ -4,7 +4,6 @@ ## Install requirements #### Configure npm NODE_PATH variable - ``` echo "export NODE_PATH=/usr/lib/node_modules" >> /etc/profile source /etc/profile > /dev/null @@ -45,13 +44,11 @@ This script asks the following information: ## Install from source-code ##### Install required NodeJS modules via npm - ``` npm install -g requestify is-running connection-tester log4js q fs-access util ``` ##### Install the Lightning-rod - ``` mkdir /var/lib/iotronic/ && cd /var/lib/iotronic/ git clone git://github.com/MDSLab/s4t-lightning-rod.git @@ -62,6 +59,8 @@ cp /var/lib/iotronic/iotronic-lightning-rod/etc/init.d/s4t-lightning-rod_yun /et sed -i "s//export LIGHTNINGROD_HOME=\/var\/lib\/iotronic\/iotronic-lightning-rod/g" /etc/init.d/lightning-rod chmod +x /etc/init.d/lightning-rod +cp /var/lib/iotronic/iotronic-lightning-rod/etc/logrotate.d/lightning-rod.log /etc/logrotate.d/lightning-rod.log + mkdir /var/log/iotronic/ touch /var/log/iotronic/lightning-rod.log @@ -85,20 +84,7 @@ sed -i "s/\"url_wamp\":.*\"\"/\"url_wamp\": \"ws:\/\/\"/g" / sed -i "s/\"url_reverse\":.*\"\"/\"url_reverse\": \"ws:\/\/\"/g" /var/lib/iotronic/settings.json ``` -##### Configure logrotate -nano /etc/logrotate.d/lightning-rod.log -``` -/var/log/iotronic/lightning-rod.log { - weekly - rotate = 3 - compress - su root root - maxsize 5M -} -``` - ##### Configure cron to launch the Lightning-rod if not yet running - ``` /etc/init.d/cron stop cp /var/lib/iotronic/iotronic-lightning-rod/etc/cron.d/root_yun /etc/crontabs/root @@ -106,7 +92,6 @@ cp /var/lib/iotronic/iotronic-lightning-rod/etc/cron.d/root_yun /etc/crontabs/ro ``` ##### Start Lightning-rod and configure it to start at boot - ``` /etc/init.d/lightning-rod enable /etc/init.d/lightning-rod start diff --git a/etc/logrotate.d/lightning-rod.log b/etc/logrotate.d/lightning-rod.log new file mode 100644 index 0000000..7028c41 --- /dev/null +++ b/etc/logrotate.d/lightning-rod.log @@ -0,0 +1,7 @@ +/var/log/iotronic/lightning-rod.log { + weekly + rotate = 3 + compress + su root root + maxsize 5M +} \ No newline at end of file