linux (49)

Davide Airaghi

Scheduled disks status checks

Having any number of disks connected to your system put you in charge of monitoring their health, acting in the right way when a disk is about to fail is crucial.

Making use of a tool that, when run on a scheduled basis, notify you on screen when a disk is not passing an healthcheck could prevent disaster from occurring.

Let's have a look at a script that could be used as a starting point to create an always on monitoring disk tool.

Continue reading...
Davide Airaghi

Contabo API - automated snapshot creation

Using VPS instances provided by Contabo could be quite easy and not that expensive, but keep in mind to always have some backup at hand and to always keep at least a single snapshot of each instance (a single snapshot is included in the standard plan).

Not forgetting this layer of data preservation could help a lot and speed up recovery processes, so ... why not having this procedures fully automated and run by some Linux system ?

Let's have a look at a possible script ...

Continue reading...
Davide Airaghi

Script to monitor backup sets

When self hosting your own backup system it's not that uncommon to have some sort of monitoring system, just to make sure backups are present and exectuted according to the scheduling.

To address this topic I added to my backup hosting server a script that:
- analyze if there are files modified in a specific internal
- use "s-nail" to send email notifications in case of issues

Continue reading...
Davide Airaghi

Borg - server side archives compacter

If you manage backups using Borg Backup you might end up consuming a lot of space on your storage (local and/or remote), even if you have scheduled "borg prune" sessions, you are using deduplication/compression also at file system level, etc. etc. To make room for…

Continue reading...
Davide Airaghi

Docker: Update all the images

If you want to pull and update all the images you have so far downloaded (and are still present on your system) using docker you can execute the following command: for IMAGE in $( LANG=en docker image ls -a --format table | grep -v -E "^REPOSITORY"…

Continue reading...
Davide Airaghi

Apache Netbeans for Linux: get latest build

After having seen how to build Apache Netbeans on a Linux box here you can find how to get the latest build (no more compiling!) from Apache servers. It'a all in a couple of shell commands : NBURL=$( wget https://builds.apache.org/view/Incubator%20Projects/job/incubator-netbeans-linux/lastSuccessfulBuild/artifact/nbbuild/ -qO- | grep -o -e…

Continue reading...
Davide Airaghi

Gestione moduli Apache per openSuse

Per la gestione del webserver Apache Httpd sulla distribuzione openSuse abbiamo il classico comando a2enmod, condiviso con altre distribuzioni, che permette di: 1) capire se un modulo è abilitato, 2) attivare un modulo che è non attivo e 3) disattivare un modulo.

Per comodità di gestione del sistema ho preparato un semplice script che si occupa di fare da wrapper verso il citato a2enmod andando a fornire funzionalità quali: 1) lista di tutti i moduli presenti sul sistema, 2) lista di tutti i moduli abilitati, 3) verifica dell'abilitazione di un modulo, 4) abilitazione di uno o più moduli e 5) disattivazione di uno più moduli.

Continue reading...
Davide Airaghi

Apache Netbeans : download ultima versione disponibile

Dopo aver visto come compilare Apache NetBeans ecco un altro modo per ottenere l'ultima versione di tale software, questa volta già in formato "compilato". Il tutto si riduce a due semplici righe da eseguire nel vostro terminale NBURL=$( wget https://builds.apache.org/view/Incubator%20Projects/job/incubator-netbeans-linux/lastSuccessfulBuild/artifact/nbbuild/ -qO- | grep -o -e "NetBeans-dev-incubator-netbeans-linux-.*-on-.*-release.zip\""…

Continue reading...
Davide Airaghi

Apache NetBeans - building and installation

NetBeans is now an Apache Foundation project, but (as of today) we lost the possibility to download a specific release (Java only, PHP, C/C++, ...), the standard version available (release 9+) is only built with Java support. I have created a very simple script that build Apache NetBeans including support for various programming languages (PHP included), getting sources from the latest tree hosted on GitHub. Continue reading...
Davide Airaghi

Apache Netbeans - compilazione e aggiornamento

Con il passaggio di NetBeans alla Apache Foundation si è, per ora, persa la possibilità di scaricare versioni specifiche e già preconfezionate di questo IDE. Se si unisce questo all'attuale impossibilità di usare la versione 9 del software, come offerta preconfezionata dalla Apache Foundation, anche per lo sviluppo PHP emerge come si debba trovare un metodo alternativo per ottenere, con poco sforzo, un tool di sviluppo aggiornato e adatto ai propri scopi.

Per questo motivo vi propongo lo script che sto usando per compilare Apache NetBeans all'ultima versione disponibile sul relativo reporistory GitHub e con il supporto a tutti i linguaggi previsti (PHP incluso).

Continue reading...
Davide Airaghi

Linux: get info about notebook battery

Below you can find a very simple shell script that gets information about every battery present in your notebook and shows a summary. create a new file (es: /usr/local/bin/battery.sh) paste inside the new file the following code #!/bin/sh oDIR=$( pwd ) oIFS=$IFS IFS=$'\n' for BATTERY…

Continue reading...
Davide Airaghi

Automatic Wpa Supplicant restart

If wifi connection used by your Linux box is not stable and goes up&down, with wpa_supplicant requiring some manual restart you could use a simple script that does it for you. Below you can find a script i'm using on a RaspberryPi 3 with Raspian installed. #!/bin/sh…

Continue reading...
Davide Airaghi

Compressione automatica file jpeg

Quante volte vi siete trovati a dover comprimere tutti i file jpeg presenti in una directory ? Quante volte il tool PageSpeed Insights di Google vi ha detto che dovevate ridurre il peso delle immagini presenti nel vostro sito ?

Una soluzione a questi noiosi problemi può essere trovata sfruttando uno script che faccia la ricerca di tutti i file .jpg presenti in una directory (e nelle sue sottodirectory) e si occupi di portarli alla qualità da voi desiderata.

Continue reading...
Davide Airaghi

Riavvio automatico di wpa_supplicant

L'uso di connessioni di rete wifi è indubbiamente molto comodo ma, rispetto alle classiche connessioni tramite cavo, ha lo svantaggio di poter essere soggetto a maggiore probabilità di disconnessione. Cosa fare se avete dei sistemi che tendono, per varie ragioni, a perdere la connessione all'access point? Semplice :…

Continue reading...
Davide Airaghi

Slackware: tenere aggiornato Gradle

L'uso di AndroidStudio per lo sviluppo di applicazioni mobile richiederà sempre di tenere aggiornata la vostra installazione locale di Gradle, azione che su Slackware potrebbe dover essere fatta manualmente (almeno attualmente è così dato che manca il pacchetto ufficiale).

Per ottimizzare questa azione, che può essere ripetitiva e noiosa nel tempo, ho realizzato un piccolo tool di download + pacchettizzazione (basandomi su quanto già presente su SlackBuilds) che:

  • scarica l'ultima versione di Gradle
  • crea il pacchetto per Slackware
  • salva il pacchetto nella directory in cui è presente lo script di pacchettizzazione

Usando quindi questo strumento non dovrete fare altro che avviarlo, aspettare che finisce e poi aggiornare il vostro sistema con quanto generato.

Vediamo quindi come utilizzare il tutto.

Continue reading...
Davide Airaghi

Nextcloud client for Slackware64

Using cloud storage is a popular choice and creating a personal cloud is now a possibility many of us have. If you want to create your own cloud storage you can install OwnCloud or NextCloud on a webserver and connect to them usng a web browser or a client application. I'll show how to install NextCloud client on a Slackware64 system. Continue reading...
Davide Airaghi

Installare Etcher su Slackware

Per la scrittura di immagini di sistemi operativi su memorie sd e/o chavette usb sono presenti svariati tool, sia puramente utilizzabili da una shell (come nel caso di dd) sia aventi una interfaccia grafica (come nel caso di UNetbootin).

In questo articolo vedremo come ottenere e pacchettizzare per la nostra amata Slackware il tool Etcher, il cui slogan è "Burn images to SD cards & USB drives, safely and easily".

Continue reading...