Posts

Showing posts from March, 2018

Steps to Build a RPM Package from Source on CentOS / RedHat | rpm-build | source tar | SPEC file

1) install rpm-build 2) download source tar 3) create SPEC file 4) create RPM file using rpm-build The RPM performs the following tasks during the build process. Executes the commands and macros mentioned in the prep section of the spec file. Checks the content of the file list Executes the commands and macros in the build section of the spec file. Macros from the file list is also executed at this step. Creates the binary package file Creates the source package file Once the RPM executes the above steps, it creates the binary package file and source package file. Let us see how to create a simple source and BIN RPM packages using a tar file. If you are new to rpm package, you may first want to understand how to use  rpm command  to install, upgrade and remove packages on CentOS or RedHat. 1. Install rpm-build Package To build an rpm file based on the spec file that we just created, we need to use rpmbuild command. rpmbuild command is part of rpm-b...

2755 permission

The first digit of a 4-character permission (in this case, the "2") specifies the setuid mode (=4), the setgid mode (=2), and the sticky mode (=1). These values are added together in a manner identical to the read/write/executable permissions above. More information is  here . It should be noted that the  setgid mode  and the  sticky mode  have special meanings for directories. Thus a permission of "2755" for a directory means that everyone has read and execute permission, while the file owner and members of the file's group additionally have write permission. And any files or subdirectories created in that directory will inherit the parent directory's group id.

Start to use 'ip' and 'ss' instead of 'ifconfig' and 'netstat'

Start to use 'ip' and 'ss' instead of 'ifconfig' and 'netstat'

Understanding Tomcat Connectors

Understanding Tomcat Connectors Connector elements are Tomcat's links to the outside world, allowing Catalina to receive requests, pass them to the correct web application, and send back the results through the Connector as dynamically generated content.   In this article, we'll learn  how Tomcat uses Connectors in its element hierarchy, take a look at some basic syntax for configuring Connectors, and explain the uses of Tomcat's two Connector types: HTTP and AJP. How A Connector Works Each Connector element represents a port that Tomcat will listen to for requests.  By arranging these Connector elements within hierarchies of Services and Engines, a Tomcat administrator is able to create a logical infrastructure for data to flow in and out of their site.  In addition to routing user-generated requests to the appropriate Services, connectors can also be used to link Tomcat to other supporting web technologies, such as an Apache web server, to efficiently...

SSH easily copy file to local system

Master connection It's easiest if you plan in advance. Open a master connection the first time. For subsequent connections, route slave connections through the existing master connection. In your  ~/.ssh/config , set up connection sharing to happen automatically: ControlMaster auto ControlPath ~/.ssh/control:%h:%p:%r If you start an ssh session to the same (user, port, machine) as an existing connection, the second session will be tunneled over the first. Establishing the second connection requires no new authentication and is very fast. So while you have your active connection, you can quickly: copy a file with  scp  or  rsync ; mount a remote filesystem with sshfs . Forwarding On an existing connection, you can establish a reverse ssh tunnel. On the ssh command line, create a remote forwarding by passing  -R 22042:localhost:22  where 22042 is a randomly chosen number that's different from any other port number on the remote machine. The...

eval | eval y='$'$x | How to execute shell command produced using echo ? eval "$(echo "mv ...")"

1 ) foo = 10 x = foo 2 ) y = '$' $x 3 ) echo $y 4 ) $foo 5 ) eval y = '$' $x 6 ) echo $y 7 ) 10 In the first line you define  $foo  with the value  '10'  and  $x  with the value  'foo' . Now define  $y , which consists of the string  '$foo' . The dollar sign must be escaped with  '$' . To check the result,  echo $y . The result will be the string  '$foo' Now we repeat the assignment with  eval . It will first evaluate  $x  to the string  'foo' . Now we have the statement  y=$foo  which will get evaluated to  y=10 . The result of  echo $y  is now the value  '10' . ============= How to execute shell command produced using echo ? I have tried doing: echo " mv /server/today/logfile1 /nfs/logs/ && gzip /nfs/logs/logfile1" | sed 's|logfile1|logfile2|g' It printed: mv / server / today / logfile2 / nfs / logs / && gzip / nfs / logs / logf...