Section: Tomcats

TomEE datasource password encryption

Nov 9, 2017 1 min.

Execute the following command to get the cipher: cd <<tomcat_home>>/bin cipher <<orginal password>> e.g. cipher Passw0rd This will give the cipher something like below xMH5uM1V9vQzVUv5LG7YLA== Use this cipher in the resources.xml with the prefix ‘cipher:Static3DES:’ as given below <resources> <Resource id="jdbc/myDS" type="javax.sql.DataSource"> password = cipher:Static3DES:xMH5uM1V9vQzVUv5LG7YLA== </Resource> </resources> alternatively you can give as below <resources> <Resource id="jdbc/myDS" type="javax.sql.DataSource"> password = xMH5uM1V9vQzVUv5LG7YLA== PasswordCipher = Static3DES </Resource> </resources>

Tomcat log backup

Jan 25, 2017 2 min.

Following script can be used to archive the log files in tomcat log directory. This script… Archives all the files in logs directory to bkup directory Deletes all the files older than ‘n’ days in bkup directory #!/bin/bash arch_logs() { for file_pattern; do i=1 for log_file in $(find $file_pattern | sort -r); do test $i -eq 1 && ((i=i+1)) && continue; sudo gzip "$log_file" sudo mv *.gz .