Michael's Workshop


Not everyone knows that kill command can also stop the process, which might be helpful if You're compiling something big during the day and disrupt other services on the same host.

To stop process gently use:

kill -TSTP pid

If it doesn't work use:

kill -STOP pid

To resume the process:

kill -CONT pid

After suspension, process is still visible in the ps aux but it's not consuming resources.

Hi folks, Here is the quick fix to the apache permission denied error:

Go to users public_html folder and do this:

find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;

Another useful tool to find and replace string in all files in subdirectories.

find . -type f -exec sed -i 's/foo/bar/g' {} +

Quick solution for searching string among the ps aux result and kill all processes matching the name.

ps -ef | grep "UID SEARCH" | grep -v grep | awk '{print $2}' | xargs kill -9

Spam sending by one of Your users may have significant impact on the server's performance and ip reputation. Here's the simple bash script to monitor the queue.

if [ `/usr/sbin/exim -bpc` -ge 100 ]; then
mail -s "Alert: There are over 100 Emails in the queue!" mail@example.org << EOF
Current Mail Queue :
`/usr/sbin/exim -bpc`
`/usr/sbin/exim -bp | /usr/sbin/exiqsumm`

High load can be caused by other factors too. By editing the script above You can monitor the load itself.

r=$(cat /proc/loadavg | awk -F. '{print $1}')
if [ $r -ge 7 ]
mail -s "Alert: Server load over $r!" mail@example.org << EOF
Server load over $r
`/usr/bin/ps aux`