Skip to content

Commit

Permalink
bugfixes RAM logs, swap and nc-database
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Apr 1, 2017
1 parent e1c46b5 commit aec77e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions etc/nextcloudpi-config.d/modsecurity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install()

# CONFIGURE
cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf
sed -i "s|SecRuleEngine .*|SecRuleEngine Off|" /etc/modsecurity/modsecurity.conf
sed -i 's|SecTmpDir .*|SecTmpDir /var/cache/modsecurity/|' /etc/modsecurity/modsecurity.conf
sed -i 's|SecDataDir .*|SecDataDir /var/cache/modsecurity/|' /etc/modsecurity/modsecurity.conf

Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/nc-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ configure()
rmdir "$DBDIR_"
}

local BASEDIR=$( dirname "$DATADIR_" )
local BASEDIR=$( dirname "$DBDIR_" )
mkdir -p "$BASEDIR"

[[ $( stat -fc%d / ) == $( stat -fc%d $BASEDIR ) ]] && \
Expand Down
4 changes: 2 additions & 2 deletions etc/nextcloudpi-config.d/nc-ramlogs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0 # Logs in RAM
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0 # /tmp in RAM
EOF

local HTTPUNIT=/etc/systemd/system/multi-user.target.wants/apache2.service
local HTTPUNIT=/lib/systemd/system/apache2.service
grep -q mkdir /etc/init.d/mysql || sed -i "/\<start)/amkdir -p /var/log/mysql" /etc/init.d/mysql
grep -q mkdir /etc/init.d/apache2 || sed -i "/\<start)/amkdir -p /var/log/apache2" /etc/init.d/apache2
grep -q mkdir $HTTPUNIT || sed -i "ExecStartPre=/bin/mkdir -p /var/log/apache2" $HTTPUNIT
grep -q mkdir $HTTPUNIT || sed -i "/ExecStart/iExecStartPre=/bin/mkdir -p /var/log/apache2" $HTTPUNIT

grep -q vm.swappiness /etc/sysctl.conf || echo "vm.swappiness = 10" >> /etc/sysctl.conf && sysctl --load
echo "Logs in RAM. Reboot for changes to take effect"
Expand Down
7 changes: 5 additions & 2 deletions etc/nextcloudpi-config.d/nc-swapfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ DESCRIPTION="Move and resize your swapfile. Recommended to move to a permanent U

configure()
{
[[ $( stat -fc%d / ) == $( stat -fc%d $SWAPFILE_ ) ]] && \
local ORIG=$( grep -oP "CONF_SWAPFILE=.*" /etc/dphys-swapfile | cut -f2 -d= )
[[ "$ORIG" == "$SWAPFILE_" ]] && return

[[ $( stat -fc%d / ) == $( stat -fc%d $( dirname $SWAPFILE_ ) ) ]] && \
echo -e "INFO: moving swapfile to another place in the same SD card\nIf you want to use an external mount, make sure it is properly set up"

sed -i "s|#\?CONF_SWAPFILE=.*|CONF_SWAPFILE=$SWAPFILE_|" /etc/dphys-swapfile
sed -i "s|#\?CONF_SWAPSIZE=.*|CONF_SWAPSIZE=$SWAPSIZE_|" /etc/dphys-swapfile
grep -q vm.swappiness /etc/sysctl.conf || echo "vm.swappiness = 10" >> /etc/sysctl.conf && sysctl --load
service dphys-swapfile restart
service dphys-swapfile restart && swapoff "$ORIG" && rm -f "$ORIG"
}

install() { :; }
Expand Down

0 comments on commit aec77e4

Please sign in to comment.