Tag Archives: Linux

Java – Determine if the running OS is Windows, Mac or Linux

The Apache Commons Lang library could help you to determine the running OS type. Here is an simple example.

pom.xml

...
<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-lang3</artifactId>
  <version>3.1</version>
</dependency>
...

Continue reading Java – Determine if the running OS is Windows, Mac or Linux

Linux – Wait until a specific pattern is written on log using tail and sed

In the Ant build.xml, i need to make sure the JBoss server is started before running the test cases. There are 2 possible approaches.

  • Using twiddle.sh to check the status
  • Monitoring server.log until “Started in” is written on it

 

I took the 2nd approach. Here is an example output log when the JBoss server is started successfully.
Continue reading Linux – Wait until a specific pattern is written on log using tail and sed

Composer – Manage your PHP dependencies

Mess up with the PHP dependencies in different environments? Composer is a PHP dependency manager where all the dependencies information are stored in the JSON file called composer.json. Similar to the pom.xml if you are using Maven in Java.

This example is done on a Windows machine. You could refer to Composer website if you are using Mac or Linux.

1. Download and install the Composer as stated in the Composer website.
Continue reading Composer – Manage your PHP dependencies

Symblic links in FTP

Actually there is no way to use symbolic links in FTP. A workaround is to mount the folder with the bind option. For example, i have a jailed FTP account and i want to allow it to access the /tmp/eureka folder.

1. Create the mount point folder in the user home directory.

mkdir /home/<username>/eureka

 

2. Mount the /tmp/eureka folder with the bind option.

mount --bind /tmp/eureka /home/<username>/eureka

 

Done =)

Reference: vsFTPd and Symbolic Links