Server Administration

Linux - Find all files changed in the last 7 days recursively

It is a common task for system administrators to identify all changes in the file system in the last few days. Here is a useful command to find all changed files in the last 7 days: find . -type f -mtime -7 -exec stat --format '%Y :%y %n' "{}" \; | sort -nr | cut -d: -f2-

How to change permissions / attributes / CHMOD for files

For changing permissions/attributes of files/directories you don't need to open them. How did you upload files to server? Through any FTP manager? Now you only need to go to installation directory of affiliate software and mark these files and directories for which you want to change permissions. Next steps depends on FTP manager you are using: In Total Commander you have to go to menu (F10) > Change attributes In FlashFXP you have to right click on files and from rolout menu choose "att...

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 executed URL: varnishtop -i ReqURL Here is example of ...

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 are many options 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 as cron 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...

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/etcls -al total 20drwxr-x--- 3 svnqual nobody 4096 Dec 13 08:1...

demo functionality check script

you need this demoLogin.php script: <?phprequire_once '../api/PapApi.class.php'; $session = new Pap_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/bashSESSID=$(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_DEM...

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 execute top 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 se...

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 your account for file size creation.. Just run ulimit command to find out file 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 (kbyt...

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 re...
×