From a54aee856d83a311181824ab08f3919e6f0275ef Mon Sep 17 00:00:00 2001 From: azlux Date: Tue, 2 May 2017 00:43:37 +0200 Subject: [PATCH] Configuration file added --- README.md | 11 +++-------- install.sh | 5 +++++ log2ram | 5 +---- log2ram.conf | 10 ++++++++++ 4 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 log2ram.conf diff --git a/README.md b/README.md index 87bec29..90b1b2a 100644 --- a/README.md +++ b/README.md @@ -15,18 +15,13 @@ chmod +x install.sh sudo ./install.sh ``` -into /usr/local/bin/log2ram -- You can change the SIZE variable if necessary -- If you prefer to use rsync, you can set the USE_RSYNC variable to `true` - ## Customize #### variables : -Into the file `log2ram` (or `/usr/local/bin/log2ram` if you have already installed it), there are two variables into the script : `SIZE=40M` and `USE_RSYNC=false` +Into the file `/etc/log2ram.conf`, there are two variables : -The first variable define the size the log folder will reserve into the RAM. - -The second variable can be set to `true` if you prefer "rsync" than "cp". I use the command `cp -u` and `rsync -X`, I don't copy the all folder every time for optimization. +- The first variable define the size the log folder will reserve into the RAM. +- The second variable can be set to `true` if you prefer "rsync" than "cp". I use the command `cp -u` and `rsync -X`, I don't copy the all folder every time for optimization. #### refresh time: The default is to write log into the HardDisk every hour. If you think this is too much, you can make the write every day by moving the cron file : `sudo mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram`. diff --git a/install.sh b/install.sh index 08aea60..59aeeaf 100644 --- a/install.sh +++ b/install.sh @@ -6,6 +6,8 @@ then chmod 644 /etc/systemd/system/log2ram.service cp log2ram /usr/local/bin/log2ram chmod a+x /usr/local/bin/log2ram + cp log2ram.conf /etc/log2ram.conf + chmod 644 /etc/log2ram.conf systemctl enable log2ram cp log2ram.hourly /etc/cron.hourly/log2ram chmod +x /etc/cron.hourly/log2ram @@ -14,3 +16,6 @@ then else echo "You need to be ROOT (sudo can be used)" fi + + +-rw-r--r-- \ No newline at end of file diff --git a/log2ram b/log2ram index 472657e..4157fc3 100755 --- a/log2ram +++ b/log2ram @@ -1,9 +1,6 @@ #!/bin/sh -SIZE=40M -USE_RSYNC=false - -# don't touch anything below here. +source /etc/log2ram.conf HDD_LOG=/var/log.hdd/ RAM_LOG=/var/log/ diff --git a/log2ram.conf b/log2ram.conf new file mode 100644 index 0000000..311dca6 --- /dev/null +++ b/log2ram.conf @@ -0,0 +1,10 @@ +# Configuration file for Log2Ram (https://github.com/azlux/log2ram) under MIT license. +# This configuration file is read by the log2ram service +# Size for the ram folder, it's define the size the log folder will reserve into the RAM. If it's not enough, log2ram will not be able to use ram. Check you /var/log size folder. The default is 40M and is basically enough for a lot of application. You will need to increase it if you have a server and a lot of log for example. + +SIZE=40M + +# This variable can be set to true if you prefer "rsync" than "cp". I use the command cp -u and rsync -X, so I don't copy the all folder every time for optimization. +# You can choose which one you want. Be sure rsync is installed if you use it. + +USE_RSYNC=false