Posts Tagged ‘Linux’

Yum Automatic Updates

You can install yum-cron to automatically download and install all available updates: yum install yum-cron chkconfig –list | grep yum – should show that the service is disabled chkconfig yum-cron on service yum-cron start Job Done – it will now check for and apply updates every night.  If its business critical solution though its probably […]

Random integers in BASH

Never really had a need for it before in BASH, but the following formula allows you to create random integers between two values: rnumber=$(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min)) Useful for example to create random passwords that have a length within a set range. < /dev/urandom tr -dc A-Za-z0-9_$*?!.:=@#% | head -c$((RANDOM %4 +8))

Configuring MySQL over SSL for client connections

Useful for setting up encrypted connections between client and server.  Parts of this can be substituted if you wished to get a certificate issued from a trusted CA. 1. Check that SSL has been compiled in MySQL on the server: SHOW VARIABLES LIKE ‘have_openssl’; or mysql –ssl –help If it says disabled or yes then […]

Linux ip useful commands

ip -4 -o addr – nicely formatted list of IPv4 addresses on machine ip link show – shows the available interfaces on machine

Bulk DNS Query in Plesk

I put this command together to grab DNS information relating to all of the domains hosted on a Plesk server.  Useful if your migrating to a new server and need to know where to update the DNS zones.  This checks the nameservers but can easily be substituted with A or MX: for domain in $(mysql […]

Spamassassin 2010 bug

A bit of an oversight – old versions of Spamassassin have an inbuilt rule to block emails with a future date.  Not a bad idea really, but the rule starts blocking things from 2010!  The rule should be fixed in newer versions, however Plesk for example uses a fairly old version. You can edit the […]

qmail adds number to recipient header

qmail sometimes adds a number to the recipient header when delivering mail locally, so for example, user@domain.com may become 3-user@domain.com.  This isn’t such a problem when mail is just being used locally, but if your using a POP connector to download mail to an Exchange server for example it will cause issues with it getting […]

Plesk 9 – Horde webmail configuration disappears

Strangely all of the webmail conf files for horde disappeared in my Plesk 9 setup. This regenerated them: for domain in `mysql -uadmin -p$(cat /etc/psa/.psa.shadow ) -Dpsa -e’select name from domains d, dom_param dp where d.id=dp.dom_id and dp.param=”webmail” and dp.val=”horde”;’`; do /usr/local/psa/admin/bin/webmailmng –set-default –vhost-name=$domain –name=horde ; done Update: seems to be a result of hotfix […]

Plesk 9 – Migration Manager set source directory

For some bizarre reason The Plesk 9 migration manager has taken away the functionality to specify the partition used on the source server.  Not very handy if you have partitions running low on disk space.  I’ve found two solutions that seem to work: On the target server edit /usr/local/psa/admin/share/migration-handler/migration_handler.py Modify the following line and update […]

List Perl modules installed

Handy command to list all Perl modules installed. perl -MFile::Find=find -MFile::Spec::Functions -lwe ‘find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC’