bugfixes RAM logs, swap and nc-database

This commit is contained in:
nachoparker 2017-04-01 10:50:59 +02:00
parent e1c46b51b4
commit aec77e4ee4
4 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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 ) ]] && \

View File

@ -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"

View File

@ -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() { :; }