Posts

Showing posts from 2018

MacOS: Could not read files copied from external drive to your Mac

While you have successfully copied the data from your external devices particularly from NTFS file system to your MacOS's file system (APFS), you still would need to struggle to access those files later for some reason. Or in certain cases being a super user you may be able to access those files, but not your applications. Here the three simple steps to fix the issue. Prerequisite: Step 1: Install the XCode command line tools. $ xcode-select --install Actual commands that fixes the issue: Step 2: Get the file information like file type, creator, and other file attributes etc. and verify. GetFileInfo <path to file> Example:  GetFileInfo /Users/venkat/backups/VMDiskFile.vmdk Step:3 Change it's file permissions by executing SetFile -c "" -t "" <path to file> Example:  SetFile -c "" -t "" /Users/venkat/backups/VMDiskFile.vmdk Your file is now accessible by all. Of course you may choose set of permissions as pe

MySQL Table Synchronization

MySQL Table Synchronization ======================= Step: 1 Download the below package and sample script for table sysnchronization. # cd /opt # wget  https://static.spiceworks.com/images/how_to_steps/0000/3025/mysql-table-sync-0.9.3.tar.gz # wget https://static.spiceworks.com/images/how_to_steps/0000/3026/syncTables.sh Step: 2 Extract above package # tar xzvf mysql-table-sync-0.9.3.tar.gz # cd mysql-table-sync-0.9.3 Step: 3 Install perl-mysql modules # yum install perl-ExtUtils-MakeMaker # yum install "perl(DBD::mysql)" Step: 4 Compile and install mysql-table-sync # perl Makefile.PL # make install Step: 4 Then open syncTables.sh read configuration on top of the script. Change the configuration

Bash: Advanced command line arguments

Bash: Advanced command line arguments Slicing down bash arguments as you want echo "arg length:" $ # for i in " ${@:1:1} " do echo " $i " done for i in " ${@:1} " do echo " $i " done echo " This is the last arg of cmd-args: " echo " ${@:$#:1} " echo " args but not last one" #shift for i in "${@:1: $( expr $# - 1 ) }" do echo " $i " done # Suggestion by Kevin: https://plus.google.com/106297454560345286689 # ${@:1:$# - 1} instead of ${@:1:$(expr $# - 1 )} for i in " ${@:1:$# - 1} " do echo " $i " done

How to: Oracle Sqlplus important flags for spool a table into CSV

How to: Oracle Sqlplus important flags for spool a table into CSV Hello, If you are trying to export a large table from a database via SQL Developer, it will take a lot of time. So to reduce the time and effort and you can log into or connect to remote Oracle DB via SQLPlus. And while importing the data, to get proper structuring to your data below flags will help you. set colsep , set headsep off set pagesize 0 set trimout on set feedback off set trimspool on set linesize 32767 set echo off SET TERMOUT OFF For explanation of those flags, please read : https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm So if you are planning to export a table then whole .sql file should look like below set colsep , set headsep off set pagesize 0 set trimout on set feedback off set trimspool on set linesize 32767 set echo off SET TERMOUT OFF spool 4802 . csv SELECT player || ',' || name || ',' || value FRO

How to check I/O throughput and latency in Linux servers

How to check I/O throughput and latency in Linux servers Hello, Recently our servers started behaving really strange. Suddenly they became very slow. Even I try with small commands such as ls , top I have got the output after a while but not with regular response. After analyzing running process and CPU utilization I went looking for I/O speed and that is where we found the issue. So checking I/O both troughput and latency is one of the important item while evaluating a Linux Server performance and you can use below commands to find. Throughput (I/O Streaming speed) dd if = /dev/zero of = /root/testfile bs = 1G count = 1 oflag = direct Latency dd if = /dev/zero of = /root/testfile bs = 512 count = 1000 oflag = direct Hope it will help you. Thank you.

How to check telnet for multiple IP at a time using Bash

How to check telnet for multiple IP at a time using Bash Hello, If you have multiple number of server and you would like check whether a particlur port open or not, generally you use telnet as below [ root@localhost ~ ] # telnet 192.168.56.102 22 Trying 192.168.56.102 .. . Connected to 192.168.56.102. Escape character is '^]' . SSH-2.0-OpenSSH_7.5 ^ ] telnet > q Connection closed. [ root@localhost ~ ] # Once connectivity got established, you have to give CTRL+] and q to exit from telnet session. For single IP this is fine but if you have multiple IPs then doing this for each IP is very annoying. But we can execute a perl command with inside a bash for loop with multiple IPs and after the threshold at alarm passed, it will exit automatically. for ip in "192.168.56.102" "localhost" do perl -e "alarm 10; exec @ARGV" "telnet " ${ip} " 22" done Here we dont have to pass any parameter to

How to check what SSL Ciphers are supported by your JVM

How to check what SSL Ciphers are supported by your JVM Hello Team, If you ever wondered what are the SSL Ciphers supported by your appliaction which running on particular JVM, then you can find it with below program. Note: Make sure you are switched into user who is allowed to start your application. Go to /tmp directory and createa file named as Ciphers.java import java . util . Iterator ; import java . util . Map ; import java . util . TreeMap ; import javax . net . ssl . SSLServerSocketFactory ; public class Ciphers { public static void main ( String [ ] args ) throws Exception { SSLServerSocketFactory ssf = ( SSLServerSocketFactory ) SSLServerSocketFactory . getDefault ( ) ; String [ ] defaultCiphers = ssf . getDefaultCipherSuites ( ) ; String [ ] availableCiphers = ssf . getSupportedCipherSuites ( ) ; TreeMap ciphers = new TreeMap ( ) ; for ( int i = 0 ; i < a

How to: Oracle Sqlplus important flags for spool a table into CSV

How to: Oracle Sqlplus important flags for spool a table into CSV Hello, If you are trying to export a large table from a database via SQL Developer, it will take a lot of time. So to reduce the time and effort and you can log into or connect to remote Oracle DB via SQLPlus. And while importing the data, to get proper structuring to your data below flags will help you. set colsep , set headsep off set pagesize 0 set trimout on set feedback off set trimspool on set linesize 32767 set echo off SET TERMOUT For explanation of those flags, please read : https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm So if you are planning to export a table then whole .sql file should look like below set colsep , set headsep off set pagesize 0 set trimout on set feedback off set trimspool on set linesize 32767 set echo off spool 4802 . csv SELECT player || ',' || name || ',' || value FROM player WHERE value I

How to check TLS version support for a remote SSL URL by using openssl ?

How to check TLS version support for a remote SSL URL by using openssl ? As recently many service providers are disabling the weak ciphers, TLSv1.2 becoming most trusted cipher at this moment compaing with TLSv1, TLSv1.1. If you want to know more about these protocols, please refer https://www.wolfssl.com/differences-between-ssl-and-tls-protocol-versions/ So if you are using services from any 3rd party/external service provider, then you want to verify the version of SSL protocol being used, then you can verify it with " openssl " # openssl s_client -connect URL:PORT -tls1_2 URL: Is the URL for which you want to check SSL supported protocol. Port: SSL port being used for that service. If your service providing supporting that protocol then you will get certificate chain in the output else you will get handshake errors in the output. Similarly you can verify support for other TLS protocols as well. TLSv1 # openssl s_client -connect URL:PORT -tl

How to get agent or nodes list from Puppet master

If you are trying to list all the nodes connected to your puppet server, then you can use below command. # puppet cert list --all For example, [ root@puppetserver production ] # puppet cert list --all + "debian.mylabserver.com" ( SHA256 ) 63:17:8A:7D:E1:94:D4:BA:F8:7E:E5:09:4A:D4:A4:67:0A:62:8C:EF:AE:F3:4B:35:33:48:8C:46:55:90:0C:F6 + "puppetserver.mylabserver.com" ( SHA256 ) D5:9F:9C:10:22:92:53:7C:29:F4:A6:E6:84:A2:53:FE:74:B6:9F:87:B0:55:65:A4:D4:5F:B9:CD:09:71:0E:FA ( alt names: "DNS:puppet" , "DNS:puppetserver.mylabserver.com" ) Hope it helps. Thank you.

BASH: grep - hide filenames without matching patterns

Hello , If you want to get count for pattern matchings in a file then you would use " -c" flag like we all do. It will print matching files with count in the ending and non matching files with count as :0 in the ending. If you are doing this for 100 files your screen will flood with matching and non-matching details. To get clear picture of only matching, if you can pipe( | ) your result into grep -v ':0$' then you will get results only for matching files. so full command would be grep 'your_pattern' file_list* | grep -v ':0$' Thats it!! Hope it helps. Thanks Raja

Bash: Connect to Oracle DB

Even you dont have tnsora defined for your database , you can still connect to database using below shell script. LOGIN_DATA = "user/password@' (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX.XXX.XXX.XXX)(PORT=1521)) (CONNECT_DATA=(SID=SID)))'" CONNECT =`sqlplus - S ${ LOGIN_DATA } <<- span=""> EOF SET ECHO OFF ; select count (*) from table ; EOF ` echo "$CONNECT"

Firewalld: Add Puppet master ports to firewalld in CentOS7.

1. Find out what are your server's active zones. [root@vihitaatma ~]# firewall-cmd --get-active-zones public   interfaces: ens192 [root@vihitaatma ~]# 2 Puppet has different ports for different services. 3000: Web based installer  8140: Communication port between Puppet Master & Agent.  61613: Used by MCollective for orachestration requests by Puppet agents 443: Puppet Enterprise console web port. 5432: PostgreSQL  8081: Puppet DB Request Port. 8142: Used by Orachestration services to accept inbound traffic/responses from Puppet Agents   [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=8140/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=61613/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=443/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=5432/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --

SQL: Give grants to all tables in a schema

Use this procedure and just execute it as normal SQL query BEGIN    FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner='Schema_name 1') LOOP       EXECUTE IMMEDIATE 'grant select,insert,update,delete on '||R.owner||'.'||R.table_name||' to < >';    END LOOP; END; Schema Name 1 : This is like to which schema you needed grants. Schema name 2: This like which schema needed those grants. For example: SchemaA should have access on all tables,view of Schema B, then Schename Name 1 would be Schema B and Schema Name 2 would be Schema A. Thanks Raja

Bash: fetch IP Address in a file using GNU grep

You can use below command grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" filename.txt 

BASH: Shell command to list only directories in the current working directory

To list only directories of your current working directory you can use below command find ./* -maxdepth 0 -type d -exec basename {} \;