Thursday, July 19, 2012

PHP error log => Remember log permissons

This is more for me self than anything else.

When enabling PHP error logging, for clients,  do:

Edit php.ini file (or create a new one in conf.d (/etc/php5/conf.d/php.ini)).

error_reporting = E_ALL & ~E_DEPRECATED
display_errors = Off
log_errors = On
error_log = /var/log/apache2/php-error.log


THEN !!!!!

Remember to chown 0666 the $error_log.

For on apache restart. The owner is root root, but user www-data, cant write to it.

HTH

Brent






Tuesday, July 17, 2012

FreeNAS KVM guest nic woes

I’m in process of testing FreeNAS on my KVM host. The problem I experienced was that FreeNAS was not picking up the Ethernet interface.

I even ran 'pciconf -vl', and lo and behold there was the nic.
I really couldn’t understand, for the below command sure works for FreeBSD 9.

This is the general  command I use for a FreeBSD guest:

virt-install --connect qemu:///system -n freebsdguestname -r 512 --vcpus=1 --disk path=/space/freebsdguest.img,size=12 -c /iso/freebsd.iso --vnc --noautoconsole --os-type unix --os-variant freebsd7 --accelerate --network=bridge:br0 --hvm;

So not to spend to much time trouble shooting, I added '--network=bridge:br0,model=rtl8139'


And it all worked.
HTH
Brent




Add additional drive or storage to a KVM guest

Ever needed to attach an additional virtual drive or storage drive to your KVM guest?

Heres how you can.

Firstly, I recommend that you backup your data!

On the KVM host, create the 'drive' with either of the following two commands

qemu-img create -f qcow2 /path/moredrivespace.img 10G
or
dd if=/dev/zero of=/path/moredrivespace2.img bs=1 seek=10G count=0

This is where it gets interesting.

Now to add your new 'drive', to your KVM guest.

Run the command 'virsh'
Welcome to virsh, the virtualization interactive terminal.
Type:  'help' for help with commands
       'quit' to quit
virsh # attach-disk KvmGuestDomainName /path/moredrivespace
.img vdo

By default or by specifying the target of vdo, the default driver will be
Virtio. If you are a FreeBSD user like I am. You will struggle, for FreeBSD will not see the device. I find you need to use a SCSI device. And inorder to use / do so, you need to run this command.


attach-disk KvmGuestDomainName /space/moredrivespace.img sda

I also found for FreeBSD, its best to use the dd command. 

As per usual, Linux guests just work.
;)

And then reboot your VM.

HTH
Brent 




Saturday, May 26, 2012

Exim Commands

Debug a mail delivery:
 exim -bt -d email@address.com 
Retry message delivery:
 exim -M messageID
Force delivery of all message:
 exim -qf
Force delivery of all message and delete of frozen ones:
 exim -qff
Shows log delivery for a message:
 exim -Mvl messageID
Display message body:
 exim -Mvb messageID
Display message header:
 exim -Mvh messageID
Delete a message without warning:
 exim -Mrm messageID
Count messages in queue:
 exim -bpr | grep "<" | wc -l or exim -bpc
Display all messages from queue:
 exim -bp
Count frozen messages:
 exim -bpr | grep frozen | wc -l
Delete frozen messages:
 exim -bpr | grep frozen | awk '{print $3}' | xargs exim -Mrm
 
P.s. You can get some more cool tips from exim cheatsheet 

Saturday, May 12, 2012

Today I needed to set up connections to 2 different ports, running on a machine, sitting behind my firewall.

I knew that I needed to set up a SSH tunnel from my laptop to the server, but I certainly did not want to open 2 different shells each time I wanted to connect to the ports.

Thankfully, the ssh command allows you to specify multiple tunnels through the same server in one command. The command to do this is:

ssh -c arcfour  -C -L 8080:127.0.0.1:8080 -L 8081:127.0.0.1:8081  homedsl.org

Monday, April 23, 2012

Im amazed by how many people don’t know about runlevels, let alone, to identify what runlevel you are in.

To see what runlevel you are in.

who -r
or
/sbin/runlevel


HTH
Brent

P.s. To find out about runlevels