Server Administration

Move already running process to background on Linux

Common problem of server administrators is, that you run command, which runs hours shortly before you leave office and heading home :-) Here are few commands, which will help you to leave your computer and let the running command finish: 1. stop currently running command: Ctrl+Z 2. To move stopped process to background execute command: bg 3. To make sure command will run after you close the ssh session execute command: disown -h 4. exit ssh, go home, process will finish on the background...

Varnish - identify account with highest traffic

If you are running on your server multiple domains and content is cached through Varnish, often you need to identify in real time who is generating highest traffic. Here are some varnish 4.x commands we use to identify accounts with highest traffic: 1. Sorted list of hostnames with highest number of requests: varnishtop -C -I ReqHeader:Host Output could look like this: 2. Another common task is to find the most frequently executedURL: varnishtop -i ReqURL Here is example of output: 3. If y...

Execute in endless loop shell command on Linux

Sometimes we need to execute in endless loop a command on Linux servers. For example in our case we needed to execute php script jobs.php in endless loop until I press Ctrl+C Here is how we did it with one command(BTW: in the same way it works also on Mac computers or Cygwin shell on Windows): while true; do php jobs.php; done

How to scan your server for viruses and malware

There aremanyoptions how to scan your server for viruses or malware. One of them is clamv software. 1. Here is how to install it e.g. on Centos: yum install clamav clamd 2. Than refresh the virus database with command: freshclam you can schedule this command ascron task to update virus database periodically 3. To scan whole server for viruses execute command: ionice -c3 nice -n 19 /usr/bin/clamscan -r --bell -i / ionice and nice we used to minimize impact of scanning on other applications run...

rm and the 'Argument list too long' error message

If you have in directory more than 1024 files and you wish to delete them all at once, for sure you got error message "Argument list too long". e.g. you did: rm -f *.log To solve this problem, pipe the names of files one by one to rm command like this: find . -name '*.log' | xargs rm -f It should be easy and still effective solution for you.

SVN not working

If SVN stops working with error: Authorization failed svn: OPTIONS of 'https://svn.qualityunit.com/svn/main/PostAffiliatePro/trunk/server/plugins/AutoResponsePlus': authorization failed: Could not authenticate to server: rejected Basic challenge (https://svn.qualityunit.com) it is possible that access to svn password file is not possible (permissions)... log in to host.x-member.com as root cd /backup/home2/svnqual/etc ls -al total 20 drwxr-x--- 3 svnqual nobody 4096 Dec 13 08:11 . drwx--x--x ...

demo functionality check script

you need this demoLogin.php script: <?php require_once '../api/PapApi.class.php'; $session = new Gpf_Api_Session('URL_TO_DEMO/scripts/server.php'); $session->login('merchant@example.com', 'demo'); echo $session->getSessionId(); ?> and then demoTest.sh file in scripts: #!/bin/bash SESSID=$(php demoLogin.php) RESULT=$(wget -qO-URL_TO_DEMO/merchants/index.php?S=$SESSID | grep 'Loading application' | wc -l) if [ $RESULT -eq 0 ] ; then sleep(30) RESULT=$(wget -qO-URL_TO_DEMO/mercha...

How to identify account with highest load on your server

Often server administrators have problems to identify, which account is generating on server highest load. Here are some tips how to identify such account: First of all executetop command. You will see load on your server and processes, which use the most of the resources. If you will see, that there is too much httpd processes in same time running on your server, you can try to check which account generates so much requests by following commands. Commands will work just on servers with WHM ser...

Overview

Not all problems are related to Quality Unit products. Some problems are caused by your server environment. We will try to list here common problems and solutions.

Why I'm not able to dump database and get error: File size limit exceeded ?

Your system administrator must have imposed limitation on youraccount for file size creation.. Just run ulimit command to find outfile size limitation:$ ulimit -a Example of output: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) 805696 pending signals (-i) 1024 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 10240 c...

How to whitelist IP from server firewall

To whitelist this on the other servers you can run the command: apf -a 72.52.198.161 It will first need to be removed from the deny list first if it is being blocked. To remove the entry: Run this command nano /etc/apf/deny_hosts.rules Press control w to start a search, then enter the IP 72.52.198.161. Once you find the location remove the two lines that the IP consist of, then exit and save the file with control x and then y to save and exit. After this run the command to restart the fi...