August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Setting the JDBC Connection timeout properties through WLST

There are different timeout properties in JDBC connection, this post explain the approach to set some of the important timeout properties through WLST script.

Inactive Connection Timeout:
The number of inactive seconds on a reserved connection before WebLogic Server reclaims the connection and releases it back into the connection pool.
You can use the Inactive Connection Timeout feature to reclaim leaked connections – connections that were not explicitly closed by the application.

Connection Reserve Timeout:
The number of seconds after which a call to reserve a connection from the connection pool will timeout.
When set to 0, a call will never timeout.
When set to -1, a call will timeout immediately.

Statement Timeout:
The time after which a statement currently being executed will time out.
A value of -1 disables this feature.
A value of 0 means that statements will not time out.

oracle.jdbc.ReadTimeout:
The property oracle.jdbc.ReadTimeout helps to set read timeout while reading from the socket.
oracle.net.READ_TIMEOUT for jdbc versions < 10.1.0.5 oracle.jdbc.ReadTimeout for jdbc versions >=10.1.0.5

oracle.net.CONNECT_TIMEOUT:
The property oracle.net.CONNECT_TIMEOUT helps to set the login time out in Oracle.

SetJDBCTimeoutProperties.py

def setJDBCTimeoutProperties():
dsName=’CRM6EAIReference’
edit()
startEdit()
 
server=’AdminServer’
cd(“Servers/”+server)
target=cmo
 
print ‘=========================================’
print ‘Setting the timeout properties for DataSource….’
print ‘=========================================’   
 
cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCDriverParams/’+dsName+’/Properties/’+dsName)
#cmo.destroyProperty(getMBean(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCDriverParams/’+dsName+’/Properties/’+dsName+’/Properties/oracle.net.CONNECT_TIMEOUT’))
cmo.createProperty(‘oracle.net.CONNECT_TIMEOUT’)

#cmo.destroyProperty(getMBean(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCDriverParams/’+dsName+’/Properties/’+dsName+’/Properties/oracle.jdbc.ReadTimeout’))
cmo.createProperty(‘oracle.jdbc.ReadTimeout’)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCDriverParams/’+dsName+’/Properties/’+dsName+’/Properties/oracle.net.CONNECT_TIMEOUT’)
cmo.setValue(‘10000’)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCDriverParams/’+dsName+’/Properties/’+dsName+’/Properties/oracle.jdbc.ReadTimeout’)
cmo.setValue(‘20000’)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCConnectionPoolParams/’+dsName)
cmo.setInactiveConnectionTimeoutSeconds(120)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCConnectionPoolParams/’+dsName)
cmo.setConnectionReserveTimeoutSeconds(30)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCConnectionPoolParams/’+dsName)
cmo.setStatementTimeout(120)

save()
activate()

print ‘Timeout settings for the datasource ‘+dsName+’ has been completed’
 
 
def main():
 
adminURL=’t3://localhost:8000′
adminUserName=’weblogic’
adminPassword=’welcome1′
connect(adminUserName, adminPassword, adminURL)
setJDBCTimeoutProperties()
disconnect()

 

main()

Execute the script:
cd %WLS_HOME%\common\bin
wlst.sh SetJDBCTimeoutProperties.py

Restart the server after successful execution.

weblogicssrrerew-7 weblogicssrrerew-8

Setting the XA Transaction timeout values for a datasource through WLST script

This post explain the approach to set some of the important timeout properties for XA datasources through WLST script.

Set XA Transaction Timeout:
Enables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.

When enabled, the WebLogic Server Transaction Manager calls XAResource.setTransactionTimeout() before calling XAResource.start, and passes either the XA Transaction Timeout value or the global transaction timeout.

XA Transaction Timeout:
The number of seconds to set as the transaction branch timeout.
If set, this value is passed as the transaction timeout value in the XAResource.setTransactionTimeout() call on the XA resource manager, typically the JDBC driver.

When this value is set to 0, the WebLogic Server Transaction Manager passes the global WebLogic Server transaction timeout in seconds in the method.

If set, this value should be greater than or equal to the global WebLogic Server transaction timeout.

XA Retry Duration:
Determines the duration in seconds for which the transaction manager will perform recover operations on the resource. A value of zero indicates that no retries will be performed.

XA Retry Interval:

The number of seconds between XA retry operations if XARetryDurationSeconds is set to a positive value.

SetXATimeoutProperties.py

def setXATimeoutProperties():
dsName=’SOADataSource’
edit()
startEdit()
 
server=’AdminServer’
cd(“Servers/”+server)
target=cmo
 
print ‘=========================================’
print ‘Setting the timeout properties for DataSource….’
print ‘=========================================’   
 
cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaSetTransactionTimeout(true)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaTransactionTimeout(3000)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaRetryDurationSeconds(300)

cd(‘/JDBCSystemResources/’+dsName+’/JDBCResource/’+dsName+’/JDBCXAParams/’+dsName)
cmo.setXaRetryIntervalSeconds(60)

save()
activate()

print ‘Timeout settings for the datasource ‘+dsName+’ has been completed’
 
 
def main():
 
adminURL=’t3://10.30.34.216:8000′
adminUserName=’weblogic’
adminPassword=’reuters123′
connect(adminUserName, adminPassword, adminURL)
setXATimeoutProperties()
disconnect()

 

main()

Execute the script:
cd %WLS_HOME%\common\bin
wlst.sh SetJDBCTimeoutProperties.py

Restart the server after successful execution.

weblogicssrrerew-6

Enabling the weblogic server to Backup/Archive the configurations(config directory) through WLST script

By enabling the backup/archiving, the administration Server can automatically backups the domain configuration (the entire domain-name/config directory) during the server boot to DOMAIN_HOME\config-original.jar and config-booted.jar. Also multiple versions of the domain config will be archived by the Administration Server, each time the domain configuration is modified into the DOMAIN_CONFIG\configArchive folder.The configuration archives can be used for system restoration in cases where accidental configuration changes need to be reversed.

The below WLST script will help us to enable the backup/archiving.

EnableArchiving.py

adminURL=’t3://localhost:8000′
adminUserName=’weblogic’
adminPassword=’welcome1′
connect(adminUserName, adminPassword, adminURL)
domainRuntime()
edit()
startEdit()
cmo.setConfigBackupEnabled(true)
cmo.setArchiveConfigurationCount(5)
save()
activate()

Execute the script.
cd %WLS_HOME%\common\bin
wlst.sh EnableArchiving.py

To verify the configuration- Login to admin console–>Click on Domain in the left panel–>Expand the Advanced in General Configuration section

weblogicssrrerew-2
When the Admin Server starts up it automatically makes a backup of  DOMAIN_HOME/config directory and stores it in DOMAIN_HOME/config-original.jar(original configuration file while restarting the server) and once the start up  completed(booted) successfully it makes a backup of DOMAIN_HOME/config directory and stores it in DOMAIN_HOME/config-booted.jar(the config file on which the server is booted successfully) .

Most of the cases both of the file contents will be same. If the server fails to boot successfully the config-booted.jar will not be generated and the old config-booted.jar file will be left as it is.

weblogicssrrerew-3
weblogicssrrerew-4
Also whenever the domain configuration is modified, the admin server archive the previous configurations to the DOMAN_HOME\configArchive folder.The files use the naming convention as config-number.jar, where number is the sequential number of the archive.After it reaches the maximum number of archive files specified in the configuration(ArchiveConfigurationCount – 5), older archive files will be discarded
weblogicssrrerew-5

Enabling/Disabling the Debug flags through WLST script – Weblogic

he Debugging flags will help us to enable/disable the debugging for different modules in weblogic.
This can done in different ways.

JVM start arguments:
Add the flags with -D to the server start up script
-DDebugEjbCaching=true

Through Admin Console:
Environment–>Servers–><<Server>>–>Debug
Select the required flags and click on Enable/Disable.

 

weblogicssrrerew-1

 

WLST Script:
EnableORDisableDFlags.py

adminURL=’t3://localhost:8000′
adminUserName=’weblogic’
adminPassword=’welcome1′
connect(adminUserName, adminPassword, adminURL)

edit()
startEdit()
serverNames=cmo.getServers()
for name in serverNames:
cd(‘/Servers/’+name.getName()+’/ServerDebug/’+name.getName())
set(‘DebugSSL’,’true’)
print ‘Modified the DFlag for ‘+name.getName()
save()
activate()
disconnect()

Execute the script.
cd %WLS_HOME%\common\bin
wlst.sh EnableORDisableDFlags.py

Debug flags for the Reference:

DebugAbbreviation                           
DebugAppContainer                           
DebugAsyncQueue                             
DebugBootstrapServlet                       
DebugClassRedef                             
DebugClassSize                             
DebugCluster                               
DebugClusterAnnouncements                   
DebugClusterFragments                       
DebugClusterHeartbeats                     
DebugConfigurationEdit                     
DebugConfigurationRuntime                   
DebugConnection                             
DebugConsensusLeasing                       
DebugDGCEnrollment                         
DebugDRSCalls                               
DebugDRSHeartbeats                         
DebugDRSMessages                           
DebugDRSQueues                             
DebugDRSStateTransitions                   
DebugDRSUpdateStatus                       
DebugDeploy                                 
DebugDeployment                             
DebugDeploymentService                     
DebugDeploymentServiceInternal             
DebugDeploymentServiceStatusUpdates         
DebugDeploymentServiceTransport             
DebugDeploymentServiceTransportHttp         
DebugDescriptor                             
DebugDiagnosticAccessor                     
DebugDiagnosticArchive                     
DebugDiagnosticArchiveRetirement           
DebugDiagnosticCollections                 
DebugDiagnosticContext                     
DebugDiagnosticDataGathering               
DebugDiagnosticFileArchive                 
DebugDiagnosticImage                       
DebugDiagnosticInstrumentation             
DebugDiagnosticInstrumentationActions       
DebugDiagnosticInstrumentationConfig       
DebugDiagnosticInstrumentationEvents       
DebugDiagnosticInstrumentationWeaving       
DebugDiagnosticInstrumentationWeavingMatches
DebugDiagnosticJdbcArchive                 
DebugDiagnosticLifecycleHandlers           
DebugDiagnosticQuery                       
DebugDiagnosticWatch                       
DebugDiagnosticWlstoreArchive               
DebugDiagnosticsHarvester                   
DebugDiagnosticsHarvesterData               
DebugDiagnosticsHarvesterMBeanPlugin       
DebugDiagnosticsHarvesterTreeBeanPlugin     
DebugDiagnosticsModule                     
DebugDomainLogHandler                       
DebugEjbCaching                             
DebugEjbCmpDeployment                       
DebugEjbCmpRuntime                         
DebugEjbCompilation                         
DebugEjbDeployment                         
DebugEjbInvoke                             
DebugEjbLocking                             
DebugEjbMdbConnection                       
DebugEjbPooling                             
DebugEjbSecurity                           
DebugEjbSwapping                           
DebugEjbTimers                             
DebugEmbeddedLDAP                           
DebugEmbeddedLDAPLogToConsole               
DebugEmbeddedLDAPWriteOverrideProps         
DebugEventManager                           
DebugFailOver                               
DebugFileDistributionServlet               
DebugHttp                                   
DebugHttpLogging                           
DebugHttpSessions                           
DebugIIOP                                   
DebugIIOPConnection                         
DebugIIOPMarshal                           
DebugIIOPNaming                             
DebugIIOPOTS                               
DebugIIOPReplacer                           
DebugIIOPSecurity                           
DebugIIOPStartup                           
DebugIIOPTransport                         
DebugIIOPTunneling                         
DebugJ2EEManagement                         
DebugJAXPIncludeClass                       
DebugJAXPIncludeLocation                   
DebugJAXPIncludeName                       
DebugJAXPIncludeTime                       
DebugJAXPUseShortClass                     
DebugJDBCConn                               
DebugJDBCDriverLogging                     
DebugJDBCInternal                           
DebugJDBCONS                               
DebugJDBCRAC                               
DebugJDBCRMI                               
DebugJDBCSQL                               
DebugJMSAME                                 
DebugJMSBackEnd                             
DebugJMSBoot                               
DebugJMSCDS                                 
DebugJMSCommon                             
DebugJMSConfig                             
DebugJMSDispatcher                         
DebugJMSDistTopic                           
DebugJMSDurableSubscribers                 
DebugJMSFrontEnd                           
DebugJMSJDBCScavengeOnFlush                 
DebugJMSLocking                             
DebugJMSMessagePath                         
DebugJMSModule                             
DebugJMSPauseResume                         
DebugJMSSAF                                 
DebugJMSStore                               
DebugJMST3Server                           
DebugJMSWrappers                           
DebugJMSXA                                 
DebugJMX                                   
DebugJMXCompatibility                       
DebugJMXCore                               
DebugJMXDomain                             
DebugJMXEdit                               
DebugJMXRuntime                             
DebugJNDI                                   
DebugJNDIFactories                         
DebugJNDIResolution                         
DebugJTA2PC                                 
DebugJTA2PCStackTrace                       
DebugJTAAPI                                 
DebugJTAGateway                             
DebugJTAGatewayStackTrace                   
DebugJTAHealth                             
DebugJTAJDBC                               
DebugJTALLR                                 
DebugJTALifecycle                           
DebugJTAMigration                           
DebugJTANaming                             
DebugJTANamingStackTrace                   
DebugJTANonXA                               
DebugJTAPropagate                           
DebugJTARMI                                 
DebugJTARecovery                           
DebugJTARecoveryStackTrace                 
DebugJTAResourceHealth                     
DebugJTATLOG                               
DebugJTAXA                                 
DebugJTAXAStackTrace                       
DebugJpaDataCache                           
DebugJpaEnhance                             
DebugJpaJdbcJdbc                           
DebugJpaJdbcSchema                         
DebugJpaJdbcSql                             
DebugJpaManage                             
DebugJpaMetaData                           
DebugJpaProfile                             
DebugJpaQuery                               
DebugJpaRuntime                             
DebugJpaTool                               
DebugLeaderElection                         
DebugLibraries                             
DebugLoadBalancing                         
DebugLoggingConfiguration                   
DebugMessaging                             
DebugMessagingBridgeRuntime                 
DebugMessagingBridgeRuntimeVerbose         
DebugMessagingBridgeStartup                 
DebugMessagingKernel                       
DebugMessagingKernelBoot                   
DebugMuxer                                 
DebugMuxerConnection                       
DebugMuxerDetail                           
DebugMuxerException                         
DebugMuxerTimeout                           
DebugPathSvc                               
DebugPathSvcVerbose                         
DebugRA                                     
DebugRAClassloader                         
DebugRAConnEvents                           
DebugRAConnections                         
DebugRADeployment                           
DebugRALifecycle                           
DebugRALocalOut                             
DebugRAParsing                             
DebugRAPoolVerbose                         
DebugRAPooling                             
DebugRASecurityCtx                         
DebugRAWork                                 
DebugRAWorkEvents                           
DebugRAXAin                                 
DebugRAXAout                               
DebugRAXAwork                               
DebugRC4                                   
DebugRSA                                   
DebugReplication                           
DebugReplicationDetails                     
DebugRouting                               
DebugSAFAdmin                               
DebugSAFLifeCycle                           
DebugSAFManager                             
DebugSAFMessagePath                         
DebugSAFReceivingAgent                     
DebugSAFSendingAgent                       
DebugSAFStore                               
DebugSAFTransport                           
DebugSAFVerbose                             
DebugSNMPAgent                             
DebugSNMPExtensionProvider                 
DebugSNMPProtocolTCP                       
DebugSNMPToolkit                           
DebugSSL                                   
DebugScaContainer                           
DebugSecurityAdjudicator                   
DebugSecurityAtn                           
DebugSecurityAtz                           
DebugSecurityAuditor                       
DebugSecurityCertPath                       
DebugSecurityCredMap                       
DebugSecurityEEngine                       
DebugSecurityEncryptionService             
DebugSecurityJACC                           
DebugSecurityJACCNonPolicy                 
DebugSecurityJACCPolicy                     
DebugSecurityKeyStore                       
DebugSecurityPasswordPolicy                 
DebugSecurityPredicate                     
DebugSecurityRealm                         
DebugSecurityRoleMap                       
DebugSecuritySAML2Atn                       
DebugSecuritySAML2CredMap                   
DebugSecuritySAML2Lib                       
DebugSecuritySAML2Service                   
DebugSecuritySAMLAtn                       
DebugSecuritySAMLCredMap                   
DebugSecuritySAMLLib                       
DebugSecuritySAMLService                   
DebugSecuritySSL                           
DebugSecuritySSLEaten                       
DebugSecurityService                       
DebugSecurityUserLockout                   
DebugSelfTuning                             
DebugServerLifeCycle                       
DebugServerMigration                       
DebugServerStartStatistics                 
DebugStoreAdmin                             
DebugStoreIOLogical                         
DebugStoreIOLogicalBoot                     
DebugStoreIOPhysical                       
DebugStoreIOPhysicalVerbose                 
DebugStoreXA                               
DebugStoreXAVerbose                         
DebugTunnelingConnection                   
DebugTunnelingConnectionTimeout             
DebugURLResolution                         
DebugWANReplicationDetails                 
DebugWTCConfig                             
DebugWTCCorbaEx                             
DebugWTCGwtEx                               
DebugWTCJatmiEx                             
DebugWTCTDomPdu                             
DebugWTCUData                               
DebugWTCtBridgeEx                           
DebugWebAppIdentityAssertion               
DebugWebAppModule                           
DebugWebAppSecurity                         
DebugWorkContext                           
DebugXMLEntityCacheIncludeClass             
DebugXMLEntityCacheIncludeLocation         
DebugXMLEntityCacheIncludeName             
DebugXMLEntityCacheIncludeTime             
DebugXMLEntityCacheUseShortClass           
DebugXMLRegistryIncludeClass               
DebugXMLRegistryIncludeLocation             
DebugXMLRegistryIncludeName                 
DebugXMLRegistryIncludeTime                 
DebugXMLRegistryUseShortClass

Invocation of https/SSL service is not working from OSB

We were trying to install the wildcard certificate to enable the communication from OSB to end system, but the following exception was displayed in the log file and also the communication to the end system is failing even though the certificate installation was successful;

<Jan 23, 2015 10:45:05 PM PST> <Notice> <Security> <localhost> <AdminServer> <[ACTIVE] ExecuteThread: ’12’ for queue: ‘weblogic.kernel.Default (self-tuning)’> <<anonymous>> <> <bac54c313ca42523:46f5522b:14b61066510:-7ffd-000000000008b798> <1423456801909> <BEA-090898> <Ignoring the trusted CA certificate “CN=*.sample.com,O=Sample,L=Sample,ST=Sample,C=US”. The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>

After analysis, we found that JSSE flag should be enabled along with Custom Host Name Verification (weblogic.security.utils.SSLWLSWildcardHostnameVerifier) to support wildcard certificate.

weblogicssrrerew

 

 

After enabling the JSSE flag, none of the https communication from OSB is working but https communication from BPEL is working fine even with the wildcard certificate(BPEL and OSB is running in the same server).

The following exception is thrown while invoking the https service from OSB.

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/”>

<soapenv:Body>

<soapenv:Fault>

<faultcode>soapenv:Server</faultcode>

<faultstring>

BEA-380000: General runtime error: java.lang.NullPointerException

</faultstring>

<detail>

<con:fault xmlns:con=”http://www.bea.com/wli/sb/context”>

<con:errorCode>BEA-380000</con:errorCode>

<con:reason>

General runtime error: java.lang.NullPointerException

</con:reason>

<con:location>

<con:node>RouteToSFDC_SearchService_BS</con:node>

<con:path>request-pipeline</con:path>

</con:location>

</con:fault>

</detail>

</soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>

This is the internal OSB server issue; the cause of the issue is that the AsyncResponseHandler does not properly register JSSEFilter for JSSE SSL.

The Weblogic patch 11866509 based on the Weblogic server version (this issues is identified in Weblogic server version 10.3.4 and 10.3.5) should be installed to resolve the issue.

How to enable SSL debug tracing in Weblogic Server?

Add the following start up options to the start up file startWebLogic.cmd/startWebLogic.sh or startManagedWebLogic.cmd/startManagedWebLogic.sh based on which file is used to start the server.

JAVA_OPTIONS=”${JAVA_OPTIONS} -Dweblogic.debug.DebugSecuritySSL=tue -Dweblogic.debug.DebugSSL=true -Dweblogic.StdoutDebugEnabled=true -Dweblogic.log.StdoutSeverityLevel=Debug -Dweblogic.log.LogSeverity=Debug”

MySQL and PostgreSQL rosetta stone

This is a short table of useful and common MySQL & PostgreSQL commands put up against each other.

MySQL

PostgreSQL

Command line client mysql psql
Connect to database use mysql; \connect postgresql;
List databases show databases; \l
List tables show tables; \dt
Describe table describe table; \d table;
Show server version select version(); select version();
Show the current time select now(); select now();
Authentication GRANT ALL PRIVILEGES ON *.* TO ‘monty’@’localhost’; (http://dev.mysql.com/doc/refman/5.5/en/adding-users.html) Edit pg_hba.conf (http://wiki.postgresql.org/wiki/Client_Authentication)
Check user privileges SHOW GRANTS FOR ‘root’@’localhost’; \du (List all users and their permission levels)
Backup mysqldump [options] db_name [tbl_name …] pg_dump [option…] [dbname]

Note for future: This reference list will grow.

Disable IPv6 lookups with Bind on RHEL or CentOS

Discovered during a recent project. Bind / Named was constantly spamming the logs about it being unable to reach root servers. The logs revealed that we were talking IPv6 addresses. Which was assumed to be disabled.

The less cool part was that in “/etc/named.conf” the following was commented out.

//      listen-on-v6 port 53 { ::1; };

It turns out that to disable the IPv6 lookups you have to edit “/etc/sysconfig/named” and set

OPTIONS="-4"

The option does the following

Use IPv4 only even if the host machine is capable of IPv6. -4 and -6 are mutually exclusive.

You then run

service named restart

This serves the very practical purpose of not spamming the logs. My ISP has yet to enable IPv6 so it does me no good.

Setting up sSMTP with GMail

Let me introduce you to the “extremely simple MTA to get mail off the system to a mailhub”. Particularly useful when you don’t want systems to have a full blown MTA installed. Such as Postfix, Exim or Sendmail. I find ssmtp extremely helpful on standalone servers that use Logwatch.

Getting this up and running requires 4 steps.

  • Installing SSMTP
  • Configuring SSMTP
  • Changing the MTA on your system
  • Testing

Installing the daemon, ssmtp.

Use your favorite package manager, in my example I’ll be using YUM. (Fedora/CentOS/RHEL/Scientific Linux). For Centos/RHEL/Scientific Linux 5.5 or 5.6 you need access to the EPEL repository to install sSMTP. Add EPEL to your system using the following command.

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

You can find eventual new links from http://download.fedora.redhat.com/pub/epel/5/i386/repoview/epel-release.html

yum install ssmtp

Configuring SSMTP

Edit /etc/ssmtp/ssmtp.conf with your favorite text editor. I’ll be using nano.

nano /etc/ssmtp/ssmtp.conf

Remove all the entries and replace it with the ones beneath.

root=insert_your_email_address here
mailhub=smtp.gmail.com:587
UseTLS=YES
UseSTARTTLS=YES
AuthUser=your_gmail_username_which_you'll_be_using_to_send
AuthPass=password

Changing the MTA

For CentOS/Fedora/RHEL

alternatives --config mta

Press the number that equals /usr/sbin/sendmail.ssmtp and you’re done.

Testing

I’m testing this using the verbose mode just to be able to see the dialogue with the Google SMTP server.

cat random_file | sendmail -v your_email_address

Changing the default PostgreSQL data folder (PGDATA)

Installing the PostgreSQL server on RHEL, CentOS, Scientific Linux or Fedora installs the PostgreSQL databases and configuration files in “/var/lib/pgsql/data”.

This may or may not be desirable. Let’s assume for a moment you have a separately crafted partition for PostgreSQL to use, let’s say a RAID10 volume. You’d want to change this.

Change the defaults

Use your favorite text editor, in my case nano to create the following file (must be the same as the name of the service)

# nano /etc/sysconfig/pgsql/postgresql

Add the following

PGDATA=/postgresql/data

Optionally you can also add the following to change the default port (example is the default port)

PGPORT=5432

Adjusting SELinux to permit the new data folder (pgdata) location

Should the following command output “Permissive” or “Disabled” then you may skip the details for SELinux.

# getenforce

Run the semanage command to add a context mapping for /opt/postgresql and any other directories/files within it.

# semanage fcontext -a -t postgresql_db_t "/postgresql/data(/.*)?"

Now use the restorecon command to apply this context mapping to the running system

# restorecon -Rv /postgresql/data

Starting PostgreSQL

# chkconfig --levels 345 postgresql on
# service postgresql initdb
# service postgresql start

You’re all set to go! Keep in mind that PostgreSQL listens to ‘localhost’ by default. To change this you need to alter the “listen_address” parameter in “/var/lib/pgsql/data/postgresql.conf” (change will require restart).