Leopard 10.5 Log Rotate

I recently had an issue where I have a Zope instance installed from source and found that the Z2.log and event.log files were 17GB and 30GB respectively.

Poking around the google, I found this reference to newsyslog.conf: http://www.wrightthisway.com/Articles/000437.html

I added this entry just for testing to see if this would work as advertised.

#logfilename                              [owner:group]   mode  count     size       when     flags

/Path/to/Zope/log/event.log  owner:group       644       5           5000       *             J

This entry tells newsyslogd to rotate the event.log file when it reaches 5000kB (5MB) and create the new file with specified owner:group permissions.  In addition keep 5 copies of the log file and compress them with bzip2 compression.

You can rotate your logs at the command line with:  sudo newsyslog -F

UPDATE:  With this solution, the Zope service doesn’t get restarted so it doesn’t continue to write to the newly created log file.

There is an option to give  PID but I have a suspicion that the process will be hung up and not restarted.

I found this http://httpd.apache.org/docs/1.3/logs.html#rotation

where I can use the rotatelogs apache command which is a piped log that allows log rotation without having to restart the service.

In order to use the rotatelogs command you would add an entry like below in your httpd.conf file.  I would change the entries to be all ErrorLog entries and only have the combined entries for Apache combined access logs.  The 5M is once the log file is 5M and the -420 is an offset for Pacific standard time.

CustomLog ‘|/usr/sbin/rotatelogs “/usr/local/apache2/logs/access_log” 5M -420’ “%h %l %u %t \”%r\” %>s %b”
ErrorLog ‘|/usr/sbin/rotatelogs “/usr/local/apache2/logs/error_log” 5M -420’

vSphere Database Backup

In my google searching to find a way to backup my vSphere database using the SQL 2005 Express that comes with vSphere I found this helpful article: http://communities.vmware.com/message/1057443

You basically just need to install SQL Server Management Studio to manage the database and back it up.

Then from within the SQL Server Management Studio you should be able to backup the VC database by browsing through the databases and right clicking on the VC database, then select Tasks>Back up.

You can download SQL Server Management Studio Express at the following link –http://msdn.microsoft.com/en-gb/express/bb410792.aspx

Test Joomla MySQL Connection

I recently ran into an issue with a Joomla site where users couldn’t login with a connection to database error.  I went poking around Google to find this neat test script.  http://joomla-r-us.com/faq/87-mysql-database-connection-test-script

<?php
///////////////////////////////////////////////////
// Joomla-R-Us
//
// Connection test to external MySQL database
//
///////////////////////////////////////////////////

// Configurations below!!

/////////  Bootstrap the Joomla Framework //////////////

define( ‘_JEXEC’, 1 );

define(‘JPATH_BASE’, dirname(__FILE__) );

define( ‘DS’, DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS.’includes’.DS.’defines.php’ );
require_once ( JPATH_BASE .DS.’includes’.DS.’framework.php’ );

/**
* CREATE THE APPLICATION
*
* NOTE :
*/
$mainframe =& JFactory::getApplication(‘site’);

/**
* INITIALISE THE APPLICATION
*
* NOTE :
*/
// set the language
$mainframe->initialise();

JPluginHelper::importPlugin(‘system’);

// trigger the onAfterInitialise events
$mainframe->triggerEvent(‘onAfterInitialise’);

/////////////////////////////////////////////////////

///////////// Configure this ////////////////////////

$hostname     = ‘myhost.mydomain.com’;
$username     = ‘myaccount’;
$password     = ‘mypassword’;
$database     = ‘joomla’;

///////////// End Configure ////////////////////////

// Try connecting to the database

$option = array ();
$option [‘driver’] = ‘mysql’;

$option [‘host’] = $hostname;
$option [‘user’] = $username;
$option [‘password’] = $password;
$option [‘database’] = $database;
$option [‘prefix’] = ”;
$db = JFactory::getDBO ();
$db = & JDatabase::getInstance ($option);
if ( get_class($db) == ‘JDatabaseMySQL’ ) {
echo ‘<b><font color=”green”>OK!</font></b>’;
} else {
echo ‘<b><font color=”red”>FAILED</font></b> : ‘ . $db->message;
}

?>

Obviously I changed the database name, username and password to match my server.

I installed it under my Joolma root and sure enough a great big green OK appeared.  Now what? I asked the maintainers of the website what had changed and nothing but a Joomla component with it’s own database was disabled.  On further investigation, I found the connection to the additional database was failing.  I granted the user access over the database and Viola!  I was able to login to my Joomla site again!

Windows Server 2008 unidentified network VMware

I am in the process of setting up a VMware virtual machine that requires one public NIC and one private NIC for iSCSI traffic.  I kept getting the “unidentified network” for the second NIC and I came across this post:  robboek.com/2008/12/18/vmware-unidentified-network-issue-in-vista-and-windows-server-2008-fix/

There is however, a very annoying problem when you install VMware on Vista (and Windows Server 2008). When you install VMware it adds a few virtual network adapters. For various reasons, these adapters are listed in the Network Sharing Center as being on an “Unidentified network (Public network)” and all of the features under Sharing and Discovery are turned off .

Here is the best fix I’ve found thanks to a post by richv in the VMware forum:

  1. Run regedit
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
  3. Underneath you should see several keys labeled 0000, 0001, 0002 etc… Look through these and find the VMware adapters. They will probably be near the end of the list if you just installed VMware.
  4. For each of the VWware adapters, add a new DWORD value named “*NdisDeviceType” and set it to 1 (make sure you get the * at the beginning of the name, I missed that the first time).
  5. Disable and Enable each of the network adapters.

That should take care of the problem. Setting *NdisDeviceType to 1 causes Windows to ignore the device when it does network identification. Here is an MSDN article with more details.

Finding the correct private NIC I added the DWORD and disabled and enabled the NIC. Now the status is Enabled but when I right click status for the NIC I am still getting “No network access”

Still searching …

could not find update.inf file

I recently tried to download and install the iSCSI initiator from microsoft.com on a Windows Server 2008 R2 server.  I kept getting an error on install saying “Setup could not find the update.inf file needed to update your system.

I found this post: www.fixed4free.com/answers.php?id=217664

which states that you will get that error if you are trying to install it on an unsupported system. Apparently the iSCSI initiator is built in to Vista and Windows 2008 so you don’t need to install it.

Found it under Administrative Tools.