Currently Browsing: Linux

Redis can’t save in background

Well I see something in log [3765] 30 Jan 11:31:10 * 1 changes in 900 seconds. Saving… [3765] 30 Jan 11:31:10 # Can’t save in background: fork: Cannot allocate memory To fix this redis error you need to echo 1 > /proc/sys/vm/overcommit_memory sysctl vm.overcommit_memory=1  
read more

centos 7 systemctl restart httpd or other service take long time

Well on centos 7 I notice that when I run systemctl restart httpd sometime take a lot of time  to restart it . After some search I found out that there is a TimeoutStopSec variable that do something like this “Configures the time to wait for stop. If a service is asked to stop, but does not terminate in the specified time, it will be terminated forcibly via SIGTERM, and after another timeout of equal duration with SIGKILL (see KillMode= in systemd.kill(5)). Takes a unit-less value in seconds, or a time span value such as “5min 20s”. Pass “infinity” to disable the timeout logic. Defaults to DefaultTimeoutStopSec= from the manager configuration file” So I modify the /usr/lib/systemd/system/httpd.service and added the TimeoutStopSec=5 Into it You need to run systemctl daemon-reload after modify that file [Service]...
read more

delete large directory containing thousands of files

Well if you try to remove a directory with multiple files rm will take a long time also some load on that server . One solution is to rsync a empty directory . mkdir empty_dir rsync -a –delete empty_dir/ yourdirectory/ Also a perl can be made but the rsync is easy for me to remeber . Some more information about this you can find here  
read more

Modify .htaccess on wordpress site to move to new domain

In order to move the wordpress to new domain you must modify the .htaccess with   #Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$$1 [R=301,L]
read more

httpd with multiple ssl and password for every key automatically

Well to use this we must use the SSLPassPhraseDialog functionality of httpd – apache . Basically into ssl.conf we put this line or modify the existing one into SSLPassPhraseDialog exec:/path/script Where script is read/execute only by root. And the script is   #!/bin/perl $server = $ARGV[0]; #print $server; if ($server eq ‘’ || $server eq ‘’ ) { print ‘password one’; } elsif ($server eq ‘’) { print ‘Password two’; }...
read more

« Previous Entries