Skip to content

Commit

Permalink
Added logrotate support
Browse files Browse the repository at this point in the history
  • Loading branch information
npeditto committed May 18, 2017
1 parent d6b7a86 commit 1b9e6e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
19 changes: 2 additions & 17 deletions docs/arduinoyun.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -62,6 +59,8 @@ cp /var/lib/iotronic/iotronic-lightning-rod/etc/init.d/s4t-lightning-rod_yun /et
sed -i "s/<LIGHTNINGROD_HOME>/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
Expand All @@ -85,28 +84,14 @@ sed -i "s/\"url_wamp\":.*\"\"/\"url_wamp\": \"ws:\/\/<IOTRONIC-SERVER-IP>\"/g" /
sed -i "s/\"url_reverse\":.*\"\"/\"url_reverse\": \"ws:\/\/<IOTRONIC-SERVER-IP>\"/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
/etc/init.d/cron start
```

##### Start Lightning-rod and configure it to start at boot

```
/etc/init.d/lightning-rod enable
/etc/init.d/lightning-rod start
Expand Down
7 changes: 7 additions & 0 deletions etc/logrotate.d/lightning-rod.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/var/log/iotronic/lightning-rod.log {
weekly
rotate = 3
compress
su root root
maxsize 5M
}

0 comments on commit 1b9e6e4

Please sign in to comment.