:::: MENU ::::

Home

  • Nov 21 / 2016
  • 0
Linux

Apache – mod_auth compatibility for 2.2 and 2.4

Since Apache 2.4, mod_auth changed and some directive like

that have been replaced with

If you want to automatically handle same configuration for multiple servers where different versions of Apache are installed, you can use this trick:

Thanks to that change, your configuration will be working whatever version of Apache you’re using.

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
  • Nov 07 / 2016
  • 0
Database

PostgreSQL – Check value is in array

With PostgreSQL, if you have a field containing an Array and you want to get all the results containing this value in the array, you can use the following command.

Here, we are looking for all the results in the table my_table containing my_value in the field my_array.

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
  • Oct 28 / 2016
  • 0
Linux

Add a confirmation dialog with bash

If you have a bash script doing some critical actions, it can be useful to add a confirmation dialog to double check with the user that he really wants to perform the action.

Here is a very simple script allowing this kind of checking:

Output will look like:

  • Case ‘yes’:
  • Case ‘no’:

It’s up to you customizing it depending on your needs and your feelings!

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
  • Oct 19 / 2016
  • 0
Linux

Apache Tomcat – Get logs directly cleaned with rotation

Tomcat allows you to rotate easily your log files with AccessLogValve but it can be more difficult to get cleaning in logs directories automatically.

For that, you can easily use some smart find commands combined with actions:

  1. Get logs older than 3 days compressed so they can be smaller but still accessible
  2. Get logs older than 60 days deleted permanently

You will probably have to adjust the logs path depending on your needs, and you can also modify the retention time for each action.
Once the command looks correct with what you’re expecting, you can set them up as cron so it can be executed automatically every day.

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
  • Oct 14 / 2016
  • 0
Linux

Generate a random file with specific size

It’s possible to easily generate a random file with specific size filled differently depending on the needs:

  • Fill a 200MB file with zeroes
  • Fill a 200MB file with random values (longer than zeroes – depending on processor)
Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
  • Sep 27 / 2016
  • 0
Linux

Escape sequences for SSH (when you’re stuck)

You can get stuck with your ssh session when your network is changing or when there’s a network disruption. You will face a lock leading to the unability to stop your session, even by doing a CTRL-C.

That’s why there’s some escape sequences you can use in that case (especially the first one when you’re stuck):

Note that escapes are only recognized immediately after newline.

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
Pages:12345678...16
Question ? Contact