First try to write tcp connection counter in C

This doesn’t work ‘cuz proc files can’t be seeked. Here is the code:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>#define STDIN 0

int cnt_size(FILE *fst) {
	fseek(fst, 0L , SEEK_END);
	int cnt = 0;
	int chr;
	if ( fgetc(fst) == EOF )
		printf("STICAZZI \n");
	while (chr = fgetc(fst) != '\n' && chr != EOF) {
		//printf ("%d\n",chr);
		cnt++;
	}

	return cnt;
}

(more…)

Export SSH Public Key

Simple script to export our public ssh to a remote host in order to login without password.

#!/bin/bash

HOST=$1
PORT=$2

if [ $# -lt 2 ]
then
echo "Error, missing one parameter."
echo "Usage: $0 HOST PORT"
exit 1
fi

cat ~/.ssh/id_rsa.pub |ssh root@$HOST -p $PORT "if [ ! -d ~/.ssh ]; then mkdir ~/.ssh; fi; touch ~/.ssh/authorized_keys && cat - >> ~/.ssh/authorized_keys"

exit 0

LRUG – Meeting November 2009

The next meeting of LRUG will be on Wednesday the 11th of November, from 6:30pm to 8:00pm. Our hosts Skills Matter will provide the space, at our new venue The Crypt (it’s very close to our previous venues). Despite the new venue it’s still important for people to register so Skills Matter know how many people to expect and set the room up correctly.
Agenda

We’re hoping for a “Ruby in Sys Admin” theme this month.
John Arundel: Is Your Sysadmin Dumber Than a Hamster? How to automate your sysadmin

out of a job, and into a more interesting job.

John offered to do a talk about Puppet and Chef covering some or more of the following topics:

* Why aren’t sysadmins as smart as developers?
* How do you build 100 servers in a day?
* How to automate the dumb stuff
* Why it’s quicker to do things more slowly
* How to convince your boss you need an automated infrastructure
* Why automation gives you staging and continuous integration for free

Event Site Link

Seems to be interesting, who come? :)

Installazione di Drupal su Gentoo

Si emerge il pacchetto:

emerge drupal

Configurazione del vhost:
Per la configurazione dei vhosts, c’e` il tool interno del pacchetto webapp-config Poniamo di dover configurare il vhost lab2.dadanoc.com nella directory /var/www/www.pippo.pluto, la sintassi di webapp-config sara` la seguente:

webapp-config -I -h www.pippo.pluto  -D /var/www drupal 6.14

Dove ovviamente 6.14 e` la versione specifica. E` anche possibile specificare uid e gid diversi del proprietario dei file aggiungendo le opzioni -u e -g.

IMPORTANTE! Pre-Upgrade
Visto che l’upgrade sovrascrive tutti i files del vhost, prima di fare qualsiasi cosa consiglio un:

tar cvfz vhost.tgz vhost_dir

Upgrade di un vhost
Per aggiornare un vhost configurato con l’applicazione, basta lanciare il seguente comando:

weba0pp-config -U [-dghus] {app-name} {app-version}
es.
webapp-config -U -h www.pippo.pluto -D /var/www

IMPORTANTE! Post-Upgrade
Dato il Pre-Upgrade, il file settings.php all’interno di ${VHOST}/sites/default e` adesso vergine, quindi, tentendo comunque conto della compatibilita`, conviene prendere quello della vecchia versione copiarlo al posto di quello vergine e cambiargli i permessi:

chmod 644 settings.php

Opzioni utili per webapp-config
Nel caso in cui si voglia vedere la lista delle applicazioni installate tramite esso:

webapp-config --show-installed

FINE!