Posts tagged linux

Plowshare – CLI DDL

0

Voici le petit outils très sympatique qui va vous permettre de faire du téléchargement DDL en CLI. Il sagit de Plowshare.

Plowshare est compatibale avec plus de 70 sites de DDL.

 

Installation

Ca va très vite:

 

Ensuite le fichier de config

 

 

Utilisation

 

Depuis un fichier text

Unix Less Command: 10 Tips for Effective Navigation

1

Less Command – Search Navigation

Once you’ve opened a log file (or any file) using less file-name, use the following keys to search. Please note that the match will be highlighted automatically by default.

Forward Search

  • / – search for a pattern which will take you to the next occurrence.
  • n – for next match in forward
  • N – for previous match in backward

Backward Search

  • ? – search for a pattern which will take you to the previous occurrence.
  • n – for next match in backward direction
  • N – for previous match in forward direction

Less Command – Screen Navigation

Use the following screen navigation commands while viewing large log files.

  • CTRL+F – forward one window
  • CTRL+B – backward one window
  • CTRL+D – forward half window
  • CTRL+U – backward half window

Less Command – Line navigation

In a smaller chunk of data, where you want to locate particular error, you may want to navigate line by line using these keys:

  • j – navigate forward by one line
  • k – navigate backward by one line

Less Command – Other Navigations

The following are other navigation operations that you can use inside the less pager.

  • G – go to the end of file
  • g – go to the start of file
  • q or ZZ – exit the less pager

Simulate tail -f inside less pager – Press F

Once you’ve opened a file using less command, any content that is appended to the file after that will not be displayed automatically. However, you can press F less command will show the status ‘waiting for data‘. This is as similar to ‘tail -f’.

Also, refer to our earlier article about how to view multiple logs files using tail -f.

Less Command – Count magic

Similar to Vim editor navigation command, you can give 10j to scroll 10 lines down, or 10k to go up by 10 lines.

  • 10j – 10 lines forward.
  • 10k – 10 lines backward.
  • CTRL+G – show the current file name along with line, byte and percentage statistics.

Other useful Less Command Operations

  • v – using the configured editor edit the current file.
  • h – summary of less commands
  • &pattern – display only the matching lines, not all.

 

 

Postfix smart hot with gmail

0

Installation de Postfix

 

configurationType of mail server : Satellite System
    • Mail Name : example.org (the name you want on your outbound mail)
    • SMTP relay host : smtp.gmail.com
    • Postmaster : I left this blank
    • Other destinations : I left this blank
    • Synchronous Queues : your choice, won’t impact the relaying
    • Network blocks to allow relay : default (unless you know what your doing)
    • Mailbox size : your choice, won’t impact relaying
    • Local address : i left this as ‘+’
    • Listen Address : all, your choice
Editer le fichier de config

 

Création du fichier de sasl_passwd

Rebuild Hash

 

Restart postfix

 

On sécurise un peu

 

 

Plesk – Migrate DB

0

On source server backup the database. You may use the following command:

On destination server create database DATADASE_NAME on domain DOMAIN.NAME with Plesk CLI /usr/local/psa/bin/database. Assign the same user and password:

Database creation through Plesk CLI /usr/local/psa/bin/database will update Plesk database with appropriate user and password correctly. Run the utility wit “–help” to get list of all available options. After creation it is possible to login to the database through DB WebAdmin in Parallels Plesk Panel on destination server: Domains -> DOMAIN.NAME -> Databases -> DATADASE_NAME -> DB WebAdmin

On destination server restore content of the database from the dump created on source server:

 

 

Multiple Virtual FTP Accounts with Plesk

1

ProFTPD is the FTP software that current versions of Plesk ship with, and thankfully found what I was looking for.

ProFTPD allows you to create multiple virtual users by using an AuthUserFile directive. The AuthUserFile directive sets the path of a textual file containing a list of users and passwords for authentication.

 

Create a user file

Edit the ProFTPD configuration file. (NOT etc/proftpd.include as Plesk overwrites that file regularly.):

 

Add this line:

 

Creat a crypted password

 

Edit the user file like this:

 

Example

 

And finaly, reload proftpd

Vmware tool – Ubuntu

0

Installation de Vmware tool sur une distribution Ubuntu

  1. Starter votre VM
  2. VM > Guest > Install vmware tool
  3. Aller en console sur la VM en root
  4. Lancer les commandes suivantes

Et voilà c’est fini

HAproxy

0

Introduction

HAProxy est un relais TCP/HTTP offrant des facilités d’intégration en
environnement hautement disponible. En effet, il est capable de :
– effectuer un aiguillage statique défini par des cookies ;
– effectuer une répartition de charge avec création de cookies pour assurer
la persistence de session ;
– fournir une visibilité externe de son état de santé ;
– s’arrêter en douceur sans perte brutale de service ;
– modifier/ajouter/supprimer des en-têtes dans la requête et la réponse ;
– interdire des requêtes qui vérifient certaines conditions ;
– utiliser des serveurs de secours lorsque les serveurs principaux sont hors
d’usage.

Il requiert peu de ressources, et son architecture événementielle mono-
processus lui permet facilement de gérer plusieurs milliers de connexions
simultanées sur plusieurs relais sans effondrer le système.

Proxy SMTP

Installation

La version sous debian lenny est la 1.3.15 mais ne support pas les statistiques.

Nous allons prendre la version de blackport

Configuration

Voici une configuration pour loadbalancer le traffic STMP sur plusieurs serveurs SMTP

En utilisant l’url http://IP:8080/stats (login: login, password: password) vous pourrez voir ou passe le traffic

rsyslogd

Creer un fichier de config

Config du fichier

On redémarre rsyslog

 

L’option “check” permet de faire du failover, c’est à dire que contrôler tout les x secondes si le serveur est up.

Il est aussi possible de changer la fréquence de contrôle comme ceci:

Dans cette example, la fréquence est de toute les 10 secondes.

 

Logging remote host to specific logfile

0

Logging remote host with syslog-ng

 

On ther logging server

First off install it, and it will remove the packages klogd, sysklogd

Now we need to modify the configuration, edit /etc/syslog-ng/syslog-ng.conf, and first we need to add udp listening to accept remote syslogs. We could do this under the s_all source, but we need to define a different source so our remote hosts logs do not get mixed in with our regular ones. Place this after source s_all is finished.

Now further down where logging starts, we need to first add a filter for our mail.log host and I will use it’s ip to do this. Then we add a log file destination for that specific host. And after that we put in the log definition with our newly created source, our host filter, and our file destination.

Go ahead and restart syslog-ng now:

Since we added a new logfile, we need to modify /etc/logrotate.d/syslog-ng. This will make sure our new logfile gets rolled. This entry has to go in before the last one which restarts the syslog-ng daemon. Here's what I put in:

 

On the host

Edit your syslog file

 

Restart syslodg... enjoy

Rename network interface

0

After removing a NIC, the name is not used anymore.
e.g. there is only eth2 and no eth0. this can cause problems with flexlm

here you find a line as:

 

simply change eth1, to eth0 or delete line to default setting.

Now execute the following command:

i.e.

DONE

 

Régler Iptables pour réécrire le traffic sortant

0

Comment rediriger le traffic sortant sur une autre ip

Une des solution consiste à réécrire tous les paquets sortant en leur réattribuant votre adresse IP failover. Pour ceci, nous allons utiliser le flux SNAT de Iptables (Source NAT).

Commençons par écire une règle de réécriture des paquet (nous supposons que l’interface réseau est eth0, que votre IP physique est 21.22.23.24 et que votre IP failover est 13.14.15.16):

Maintenant, tout le traffic réseau sortant se verra attribuer votre IP failover comme étant votre IP failover (13.14.15.16).

Page 1 of 3123
Go to Top