Monday, January 11, 2016

Documentation about rest api standards

How to specify default format for FOS\RestBundle to json

In src/apibundle/Resources/config/routing.yml with yaml configuration

api:
    type:     rest
    resource: "@APIBundle/Resources/config/routing.yml"
    defaults: {_format: json} 
    prefix:   /api

Wednesday, January 6, 2016

Vider le cache disque sous Linux

Pour vider le cache disque de la mémoire sous Linux, une simple commande (en root) suffit :
sync; echo 3 > /proc/sys/vm/drop_caches
Exemple. Avant, on utilise 3.5 Go sur les 4 disponibles :
 free -m
             total       used       free     shared    buffers     cached
Mem:          3950       3540        409          0        698       1472
-/+ buffers/cache:       1368       2581
Swap:         4000         15       3984
Après passage de la commande, on n'utilise plus que 1.5 Go  :
 free -m
             total       used       free     shared    buffers     cached
Mem:          3950       1407       2542          0          1        101
-/+ buffers/cache:       1304       2645
Swap:         4000         15       3984

Check this out: http://www.vincentliefooghe.net/content/vider-le-cache-disque-sous-linux

How to Start-Stop MySQL Server on CentOS Server

This small post is to explain how you can start/stop/restart MySQL server from command line on CentOS Server.
Stop MySQL Server
  1. # /etc/init.d/mysqld stop
Start MySQL Server
  1. # /etc/init.d/mysqld start
Restart MySQL Server
  1. # /etc/init.d/mysqld restart

Check this out : http://www.niteshluharuka.com/how-to-start-stop-mysql-server-on-centos-server/

Friday, January 1, 2016

How to force cp to overwrite without confirmation

You can do yes | cp -rf xxx yyy, but my gutfeeling says that if you do it as root - your .bashrc or .profile has an alias of cp to cp -i, most modern systems do that to root profiles.
You can check existing aliases by running alias at the command prompt, or which cp to check aliases only for cp.
If you do have an alias defined, running unalias cp will abolish that for the current session, otherwise you can just remove it from your shell profile.
You can temporarily bypass an alias and use the non-aliased version of a command by prefixing it with \, e.g. \cp whatever

How to determine Plesk version/build?

Check this out : http://kb.odin.com/en/8732

How to find Plesk version in GUI?

Plesk version and microupdate information can be found on the Home page.
  1. Login to your Plesk
  2. Open Home tab. Under the System Overview section you will find panel version:
System Overview

How to find Plesk version through command line?

Plesk for Linux

  1. Version information can be found in the "$PRODUCT_ROOT_D/version" file, e.g.:
    # cat /usr/local/psa/version
    11.5.30 CentOS 6 115131204.15
    
    Output shows the Plesk version, operating system, and build number. In this example, the version is 11.5.30. The operating system is CentOS 6, and the build number is 115131204.15.
  2. The following command shows information about installed microupdate:
    # cat /root/.autoinstaller/microupdates.xml
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <patches>
        <product id="plesk" version="11.5.30" installed-at="20130925T023056">
            <patch version="29" timestamp="" installed-at="20140118T033218" />
        </product>
    </patches>
    
    In this example, Plesk version is 11.5.30. The microupdate version is #29, and the date when it was installed is2014/01/18 at 03:32:18.
  3. Also you may use system package managers to find your Plesk version:
    RPM based system:
    ~# rpm -q psa
    psa-11.5.30-cos6.build115130819.13.x86_64
    
    on Debian:
    ~# dpkg -l psa
    ii  psa 11.5.30-debian6.0.build115130819.13          Parallels Panel v11.5.30 core files