How to make permanent changes in resolv.conf

a) Set “PEERDNS=no”  and “PEERROUTES=no” in :


b) Set “NM_CONTROLLED=no” in:


c)  chattr +i /etc/resolv.conf


This options lock the entries in resolv.conf.

Click to rate this post!
[Total: 3 Average: 4]

How to migrate Jenkins credentials from old server to the new one.

1. Create same git users with whatever password you want (later will be overwrite)on the new JENKINS server.

2. Stop new and old Jenkins servers.

3. Copy secret files and folder from $OLD_JENKINS_HOME/secret* to the new $NEW_JENKINS_HOME root


4. Copy credentials.xml file from $OLD_JENKINS_HOME/credentials.xml to the $NEW_JENKINS_HOME root


5. Start the new JENKINS server.

NOTE:  This approach was susccessfully tested on both linux and windows.

Click to rate this post!
[Total: 4 Average: 3.3]

Bash script for taking java thread dump triggered by CPU load



## Title: Bash script for taking java thread dump triggered by CPU load an get notified by email using sendmail.

##Alternative solution to take  java dumps it`s  with jstack -l

## Older dumps will be erase in function of how many days you set it on the “RETENTION_DAYS” variable.

# #!!!Execute this as the user that’s running the java process!!!

##!!! If CPU load will stay over “TRIGGER” a while  the script will run again only after one hour(you can set whatever resting time you want)!!!.

## Author: BoierMoflea

# #Email: [email protected]


JCMD=”/your jdk install dir path/jcmd”


LOAD=`cat /proc/loadavg | awk ‘{print $1}’`
RESPONSE=`echo | awk -v T=$TRIGGER -v L=$LOAD ‘BEGIN{if ( L > T){ print “greater”}}’`
LASTDUMP=$(find $LOG_DIRECTORY -type f -mmin -60 |wc -l |awk ‘{print}’)
NODUMP=`echo | awk -v C=$COUNTER -v L=$LASTDUMP ‘BEGIN{if ( L == C){ print “proceed”}}’`

PID=`$PS auxww | $GREP “$PROCESS” | $GREP -v $GREP |$AWK ‘{print $2}’`

CURRENT_DATE=`$DATE +’%m-%d-%y_%T’`
MONTH_DAY_YEAR=`$ECHO $CURRENT_DATE | $AWK -F ‘_’ ‘{print $1}’`

#check if LOG_DIRECTORY exists
if [ ! -d “$LOG_DIRECTORY” ]; then
$ECHO “Create ${LOG_DIRECTORY} and set the permissions so the user executing the dump can write to this directory”
$ECHO “Failed to take a dump :)”
exit 1

#create sub directory for this day’s dumps
if [ ! -d “${LOG_DIRECTORY}/${MONTH_DAY_YEAR}” ]; then

if [ -z “$PID” ]; then
$ECHO “Failed to find any java process with ‘${PROCESS}’ in its name”
$ECHO “Failed to take a dump :)”
exit 1

if [[ $RESPONSE = “greater” && $NODUMP = “proceed” ]]; then

$JCMD $PID Thread.print > ${LOG_DIRECTORY}/${MONTH_DAY_YEAR}/thread_dump_${CURRENT_DATE}
( $ECHO “Subject: Thread dump was created for java PID=$PID (CPU-LOAD)=$LOAD, TIME=$CURRENT_DATE”; $CAT ${LOG_DIRECTORY}/${MONTH_DAY_YEAR}/thread_dump_${CURRENT_DATE} ) | $MAIL [email protected]
exit 1
#Clean up older dumps
$FIND $LOG_DIRECTORY -type d -ctime +${RETENTION_DAYS} -exec rm -rf {} \;


Click to rate this post!
[Total: 2 Average: 5]

Email setup on iOS Devices

How to configure your iOS device

  • Tap Settings
  • Tap Mail, Contacts, Calendars


  • Tap Add Account

  • Choose Other

  • Choose Add Mail Account



New Account Information

  1. Enter your Name
  2. Enter your email address as the Address
  3. Enter the password for your email address
  4. Tap Next


Incoming Mail Server

  • Host Name: This is typically your domain name preceded by “mail.”. This can be found in the E-mail Accounts section of the cPanel, under More > Configure Mail Client.
  • User Name: Your email address.
  • Password: The password for your email address.

Outgoing Mail Server

Although iOS may indicate these fields as optional, please enter your full email address and password


  • Host Name: This is the same as the incoming server.
  • User Name: This is required and again is your email address.
  • Password: The password for your email address.
  • Tap Next.


Cannot Verify Server Identity

This error message occurs because the certificate is for * not your domain. Click continue to accept the certificate.

Mail and Notes

The final screen will ask if you want mail and notes turned on for this account. Leave them both on and tap Save.

  1. Leave Mail and Notes set to on.
  2. Tap Save.
Click to rate this post!
[Total: 0 Average: 0]

FileZilla Error: Failed to retrieve directory listing


When you try to access an account using a regular (unencrypted) FTP session after upgrading to FileZilla version, you receive the following error messages:

Error: Connection timed out
Error: Failed to retrieve directory listing
This issue does not apply to SFTP connections. SFTP connections continue to function normally.

If you are unsure which FileZilla version is installed on your computer, follow these steps:

  1. Start FileZilla.
  2. On the Help menu, click About.


FileZilla forces TLS encryption on plain FTP connections. This applies both to new sites you create in the Site Manager, as well as any sites you have previously configured.

You can resolve this problem by resetting your accounts to use plain, unencrypted FTP connections. To do this, follow these steps:

  1. Start FileZilla.
  2. On the File menu, click Site Manager.
  3. Under Select Entry, click the site.
  4. On the General tab, in the Encryption list box, select Only use plain FTP (insecure).
  5. Click OK.
Click to rate this post!
[Total: 2 Average: 5]

Tutorial Litespeed Multiphp

The default installation of LiteSpeed Web Server provides external applications for PHP5 and PHP7. With cPanel and other hosting control panels, though, administrators can provide even more versions of PHP (e.g. PHP 5.5.30 or PHP 5.6.16  PHP 7.0.0). Providing these multiple versions in LiteSpeed requires further customization of your setup. This document details the steps needed to create custom PHP script handlers in the control panel environment (cPanel, DirectAdmin, Plesk, etc) to provide for multiple PHP versions. Enabling multiple PHP versions provides flexibility to suit different end user needs and improves service quality.

When using LSWS with a control panel, users’ web server configurations (httpd.conf files) are managed via the control panel. LSWS can manage server-level settings, but has no control over the the individual user level (the virtual host level). LSWS instead reads these user-specific configurations via the Using Apache Configuration File settings at the server level. Thus, to make multiple PHP versions available to users, some settings can be set through the WebAdmin console while other settings are changed directly through directives in the appropriate files. The following steps are required:

  • Multiple external applications need to be created in LSWS at the server level. Each external application will correspond with a compiled PHP binary (different PHP versions or same version with different extensions).
  • Script handlers need to be set up in LSWS at the server level to correspond with each external application created. This step essentially creates MIME types for each php binary built.
  • To configure special MIME types at the user level, AddHandler, AddType, or ForceType directives need to be added in httpd.conf or .htaccess files.


1. Compile multiple PHP versions (with needed extensions) for LSWS via command line.

  './configure' '--prefix=/usr/local/lsws/lsphp5530' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed' '--with-config-file-path=/usr/local/lsws/lsphp5530/etc/' '--with-sqlite=shared'
'./configure' '--prefix=/usr/local/lsws/lsphp5616' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed' '--with-config-file-path=/usr/local/lsws/lsphp5616/etc/' '--with-sqlite=shared'
./configure' '--prefix=/usr/local/lsws/lsphp70' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed' '--with-config-file-path=/usr/local/lsws/lsphp70/etc/' '--with-sqlite=shared'

It is also possible to compile different LSPHP versions from the WebAdmin console (Actions → Compile PHP). Doing so from the WebAdmin console, though, puts each LSPHP build in /usr/local/lsws/fcgi-bin/lsphp-version(i.e. /usr/local/lsws/fcgi-bin/lsphp5530 for LSPHP 5.5.30). Because of this naming convention, you can use the WebAdmin console to compile PHP ONLY IF you do not use PHP builds of the same version but with different extensions. 

2. Set up each PHP version binary as an LSAPI type external application (with a unique name) in LSWS at the server level. (LSWS WebAdmin Console → Configuration → Server → External App → Add) Sample settings below:

     lsphp55 --> PHP 5.5.30
           Name: lsphp55
           Address: uds://tmp/lshttpd/lsphp55.sock 
           Command: /usr/local/lsws/lsphp5530/bin/lsphp
           Auto Start: Yes
           Memory Soft Limit(bytes): 200M
           Memory Hard Limit(bytes): 300M
           Process Soft Limit: 200
           Process Hard Limit: 200
     lsphp56 --> PHP 5.6.16
           Name: lsphp56
           Address: uds://tmp/lshttpd/lsphp56.sock
           Command: /usr/local/lsws/lsphp5616/bin/lsphp
           Auto Start: Yes
           Memory Soft Limit(bytes): 200M
           Memory Hard Limit(bytes): 300M
           Process Soft Limit: 200
           Process Hard Limit: 200
     lsphp54 --> PHP 7.0.0
           Name: lsphp70
           Address: uds://tmp/lshttpd/lsphp70.sock
           Command: /usr/local/lsws/lsphp70/bin/lsphp
           Auto Start: Yes
           Memory Soft Limit(bytes): 200M
           Memory Hard Limit(bytes): 300M
           Process Soft Limit: 200
           Process Hard Limit: 200

Note: The socket addresses can be anything, but they must be unique. Memory limits and process limits given are for reference. Modify as needed.

3. Each external application must have script handlers set up at the server level to tell the web server which scripts to send to which application. Script handlers are set up in the LSWS WebAdmin console. (LSWS WebAdmin Console → Configuration → Server → Script Handler → Add) Sample script handler settings are below:

        suffix --> ext app
        php 5.5.30 --> lsphp55
        php 5.6.16 --> lsphp56
        php 7.0.0  --> lsphp70

Creating script handlers automatically creates MIME types for the suffixes you stipulate. (This only happens for the first suffix stipulated in each script handler’s settings. Additional suffixes require that you set up a corresponding MIME type manually in LSWS WebAdmin Console → Configuration → General → MIME Settings.) The MIME types automatically set up for the suffixes stipulated above would be:


4. You and your users can now go into your files and change file suffixes so that each script goes to the proper application (and thus the proper version of PHP). You can also use directives (in httpd.conf and .htaccess files) to manipulate how the server translates suffixes into MIME types. It is these MIME types, not the actual suffixes on the file, that the server looks at when assigning scripts to script handlers. Thus the AddType, ForceType, and AddHandler directives can change which script handler a file goes to, even if the actual suffix is not changed. For example, the following in a .htaccess file would cause all .php files in that directory to be processed by PHP 5.5.30 (because it would be sent to the lsphp55 external application):

        AddType application/x-httpd-php55 php

The directive below would also have the same effect:

        AddHandler application/x-httpd-php55 php

Another way to solve the problem is to use the ForceType directive. ForceType in a .htaccess file changes all files in the directory to a single MIME-type. The following command would cause all files in this directory to be sent to the lsphp55 external application:

        ForceType application/x-httpd-php55

If you want to use multiple PHP versions for files in the same directory, you will have to change some suffixes. In the following example we’re using all three versions of PHP for files with different suffixes in the same directory:

        AddType application/x-httpd-php56 php56
        AddType application/x-httpd-php55 php
        AddType application/x-httpd-php70 php70

Note: The latest PHP version compile remain default but you can change it at your desire in /usr/local/lsws/fcgi-bin

lrwxrwxrwx 1 root root 7 Nov 25 13:54 lsphp4 -> ./lsphp*
lrwxrwxrwx 1 root root 37 Dec 22 15:45 lsphp5 -> /usr/local/lsws/fcgi-bin/lsphp-5.6.16*     (delete  this symlink and create a new one with your desire php version)
lrwxrwxrwx 1 root root 11 Dec 22 13:03 lsphp7 -> lsphp-7.0.0*


Problems that can be easy resolved:

PDO extension when native PDO is being used and it does not appear to be loaded.

add to php.ini configuration  /usr/local/lsws/lsphp5616/etc/php.ini

Click to rate this post!
[Total: 3 Average: 5]