The Blog

Month: August 2013

Managing power plans on win 7 with task manager.

Posted on

You can use Task scheduler to run powercfg.exe

use a command window to run powercfg /? so you can see the various commands available

running powercfg /l lists the codes “GUIDs” for your power schemes

running powercfg -s sets the active scheme – this is the command you want to set up in Task scheduler & you’ll need to select the “Run with highest privileges” checkbox in task scheduler to run the command using admin rights [or a command line window opened with admin rights during testing]. All powercfg commands that do more than provide info will need admin rights.
I assume you are running Win7 [I think these items are the same in Vista but cannot check].

Posted in Uncategorized Leave a comment

SSHD slow on login

Posted on

Does the IP you’re connecting from have reverse DNS on it?

When you connect to SSH, By default it will try to do a DNS lookup on the IP connecting and if it can’t find a record it causes a long delay when logging in.

If you want you can disable sshd from doing a reverse lookup by setting

UseDNS no

In /etc/ssh/sshd_config and restarting sshd.

service sshd restart

Posted in Linux Leave a comment

Setting up pflogsumm on CentOS to run nightly on PLESK Postfix

Posted on

Here is a small post on how to setup pflogsumm on your CentOS mail server running Postfix.  It takes advantage of logrorate being called nightly by cron.

1. Install pflogsumm

# yum install postfix-pflogsumm

2. Run a test

# /usr/sbin/pflogsumm /var/log/maillog

3. Update /etc/logrotate.d/syslog.  Add the following:

 prerotate
    pflogsumm /usr/local/psa/var/log/maillog | mail -s "Postfix Log - `date`" [email protected]
 endscript

And little script to send you log hourly if you send over 100 emails per hour.
Make sure to add it to your hourly cron job.

 
#!/bin/sh

hour_now=$(date | awk '{print $2,"", $3, substr($4,0,2)}')
var1=$(grep "$hour_now" /usr/local/psa/var/log/maillog|pflogsumm)
if (( $(echo "$var1" | sed -n '/  delivered$/p' | tr -d '[:alpha:]') > 100 ));
then
echo $var1 | mail -s "Postfix Log - `date`" [email protected]
fi
Posted in PLESK 1 Comment