Section en-shell

Configure Exim to send emails with Gmail

Written by on 12/12/2022
Tags:  
We will see how to configure Exim4 to send system emails with Gmail. This will ensure that your emails sent with your CRON are correctly routed and do not end up in spam. Let's install Exim4 apt-get install exim4 Configuration dpkg-reconfigure exim4-config Choose: mail sent by smarthost; no local mail Then answer the questions as follows: System mail name: YOUR_HOSTNAME IP-addresses to listen on for incoming SMTP connections: 127.0.0.1 ; ::1 Other destinations fo...

Install Dropbox headless on a Linux server

Written by on 30/09/2021
Category:   Linux, Shell
Tags:  
Dropbox est un service de stockage et de partage de copies de fichiers locaux en ligne proposé par Dropbox Inc. Via un agent installé sur votre ordinateur ou mobile, il est capable de synchroniser une arborescence sur le cloud et permet ainsi une sauvegarde et un versionning de celui-ci.L’usage classique de Dropbox est d’utiliser un outil sur votre Desktop. Un usage moins évid...

Migration and upgrade of a GitLab-ce server

Written by on 29/06/2021
Tags:  
Every 5 years, it's the same song and dance. The Debian LTS version is expiring, and it's time to update the server. It's also an opportune moment to upgrade to a newer machine to benefit from improved performance.If we have a SATA hard drive, it's better to start with new disks regardless, since their lifespan is limited. So we will proceed with a series of backups on the old server, transfer them to the new one, and reinstall everything as it was. In our case, we were on Debian 8, which sup...

Replace a string in a large file with VI

Written by on 29/03/2021
Category:   Shell
Tags:   bash, shell, command line, linux, VI, VIM
A large file, and no powerful enough editor at hand to perform a search/replace? It's simple with vi. Edit the file with the vi command vi file Then in the editor type: :%s/mystring1/mystring2/ Remplacer une chaine dans un gros fichier avec VI Alternatively, there is another option with sed: sed -i -e "s/mystring1/mystring2/g" file If the string contains special characters, they will need to be escaped with a backslash '\' sed -i -e "s/\#mystring1/\#mystring2/g" ...

[GIT] Export revisions with file structure

Written by on 10/12/2015
Category:   Shell
Tags:   git
To perform an export, similar to how tortoiseSVN does which allows exporting files from one or several revisions, along with their directory structure (which is convenient for a production deployment), simply execute the following command, specifying the previous revision and the latest revision: git diff-tree -r --no-commit-id --name-only 6c16aaab 35168851| xargs tar -rf /var/www/delivery.tar

Delete a branch in git

Written by on 10/10/2015
Category:   Shell
Tags:   git
To completely remove a branch from your git server (including history), simply use the following command:git push origin --delete [branch name]Then you need to run the following command on the instances to remove the information of the deleted branch: git fetch --all --pruneIf for one reason or another, you need to delete one or more files from previous commits, here is an interesting article on the subject:https://help.github.com/articles/remove-sensitive-data/

SVN: Resolve a conflict on a folder

Written by on 15/04/2015
Category:   Shell, SVN
Tags:   svn, shell
To resolve this kind of conflict on a working copy: svn: E155015: Échec de la propagation (commit), détails : svn: E155015: Arrêt de la propagation : '/var/www/prj/wp-content/cache' demeure en conflit To do this: svn resolve --accept=working /var/www/prj/wp-content/cache For an entire directory (accept all) svn resolve --accept=working --depth infinity

[Ubuntu] enable numlock on boot

Written by on 12/03/2015
Category:   Linux, Ubuntu 14.04 LTS, Shell
Tags:  
To enable the numeric keypad on startup, install numlockx and  create or edit the file sudo apt-get install numlockx puis créez ou éditez le fichier de conf suivant : #Pour 14.04 LTS sudo vi /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf #Pour 16.04 LTS /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf and add the following information: #Pour 14.04 LTS [SeatDefaults] greeter-setup-script=/usr/bin/numlockx on #Pour 16.04 LTS [Seat:*] greeter-...

[ubuntu] Force sound output to a Bluetooth device

Written by on 09/01/2015
Category:   Linux, Ubuntu 14.04 LTS, Shell
Tags:  
On Ubuntu 14.04 LTS, a critical and unpatched bug has been reported. When a Bluetooth device is paired, it is impossible to force the system to play sound through it. The workaround is to force the output in shell: sudo pactl list cards short 0 alsa_card.pci-0000_00_1b.0 module-alsa-card.c 4 bluez_card.FC_58_FA_89_91_2C module-bluetooth-device.c sudo pactl set-card-profile 4 a2dp

[Ubuntu] Install Java 8 (JDK 8) on Ubuntu

Written by on 24/12/2014
Tags:  
Step 1: Install Java 8 (JDK 8) $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer Step 2: Verify the Java version $ java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) Step 3: Generate the default variables $ sudo apt-get install oracle-java8-set-default

shell: mirror a directory with lftp

Written by on 28/11/2014
Category:   Linux, Shell
Migrating a large website (several gigabytes) can be a tedious task to do from your workstation (with filezilla, for example). If you have a machine at a hosting provider with shell access, the lftp solution can quickly prove to be the ultimate alternative.Retrieve the files:lftp -e 'mirror /repertoir/distant /repertoir/local' -u login,password -p 21 www.host.comSend the files:lftp -e 'mirror -R /repertoir/local /repertoir/distant' -u login,password -p 21 www.host.comSend the files with 10 si...

Ubuntu: Install suPhp

Written by on 29/10/2014
Tags:  
This installation has been tested on Ubuntu 14.04LTS but could also be used for a Debian production server.Installation of Basic Packagessudo apt-get install \ build-essential \ fakeroot dh-make \ debconf execstack \ dh-modaliases \ xserver-xorg-dev \ automake \ autoconf \ libaprutil1 \ libaprutil1-dev \ libsvn-dev \ wx2.8-headers \ libwxgtk2.8-dev \ libxml2-dev \ libpcre3-dev \ libbz2-dev \ libcurl4-openssl-dev \ libjpeg-dev \ libpng12-dev \ libxpm-dev \ libfreetype6-dev ...

Ubuntu: Install RabbitVcs

Written by on 29/10/2014
Category:   Linux, Ubuntu 14.04 LTS, Shell, SVN
In fact, RabbitVcs is very easy to install... Except when there's a problem, and then... one can search for a long time 😟Here's how to resolve most installation issues on Ubuntu 14.04LTS.1 – Add the sourcesudo add-apt-repository ppa:rabbitvcs/ppa or add the source to your /etc/apt/sources.list filedeb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu trusty main2 – Install the packages sudo apt-get update sudo apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus3 3 – M...

ZEND: Create a CLI file and activate it in the shell

Written by on 15/05/2014
Category:   PHP, Shell, Zend
To add a cron job and make it accessible in the shell, you first need to configure your environment to point to the libraries.Step 1: Add the zf script to the /usr/bin/ directory (zf.sh and zf.php) These files are available in the bin directory of the ZendFramework 1.x library. You can either copy them or create a symbolic link.Step 2: Configure your bash to recognize the zf alias. Edit the ~/.bashrc file and insert the following line alias zf="/usr/bin/zf.sh" Step 3: Add the global variable ...

Shell: Delete all .svn recursively

Written by on 15/05/2014
Category:   Shell, SVN
Tags:   svn, bash, shell, command line
To recursively remove all svn management files (.svn) from a working copy, simply navigate to the root directory of your working copy and execute the following command: find . -name ".svn" -exec rm -rf {} \; Another solution is to create an alias in your ~/.bashrc and then execute the command when needed: alias rmsvn='find . -name ".svn" -exec rm -rf {} \;'

SVN: Perform a recursive add in shell

Written by on 15/05/2014
Category:   Shell, SVN
Tags:   svn, bash, shell, command line
To add files recursively from the command line with svn, we have several possibilities.The first one, probably the cleanest: svn add --force * --auto-props --parents --depth infinity -q Although only the following options seem really necessary: svn add --force * Then there are alternative solutions a bit more complicated to understand: svn status | grep '?' | sed 's/^.* /svn add /' | bash svn add `svn status .|grep "^?"|awk '{print $2}'` svn st | grep "^\?" | awk "{print \$2}" | xargs svn...