- Generate static awstats reports

This is the script I use to generate static reports from awstats


## (C)2010 Samuele Santi
## License: GPL v3 or later
## Date: 2010-02-23


cat > "$STATIC_DEST/index.html" << EOF
<html><head><title>AWSTATS - Static</title></head><body>
<h1>AWSTATS - Static Statistics</h1>

for conf in $( ls /etc/awstats/ | grep "^awstats\..*\.conf\$" | sed "s/^awstats\.\(.*\).conf\$/\1/" ); do
    echo "Generating static pages for $conf ..."
    if [ ! -e "${STATIC_DEST}/${conf}" ]; then
        mkdir -p "${STATIC_DEST}/${conf}"
    /usr/share/doc/awstats/examples/ \
        -awstatsprog=/usr/lib/cgi-bin/ \
        -dir="${STATIC_DEST}/${conf}" \
        -config="$conf" -buildpdf ...

Minimal LUKS Guide


This is a really short guide, to be used only by users with some experience of LUKS. Please refer to more extensive guides if this is the first time you configure an encrypted device.

fdisk /dev/sdx
cryptsetup -y --cipher aes-cbc-essiv:sha256 --key-size 256 luksFormat /dev/sdx1
cryptsetup luksOpen /dev/sdx1 crypt_sdx1
mkfs.ext3 -m 0 -j -O dir_index,filetype,sparse_super /dev/mapper/crypt_sdx1
tune2fs -m 0 -c 0 -i 0 -L label /dev/mapper/crypt_sdx1
mount /dev/mapper/crypt_sdx1 /mnt/crypt_sdx1
umount /dev/mapper/crypt_sdx1
cryptsetup luksClose crypt_sdx1

The slightly-longer guide

This part includes just some output of ...

Drupal crons run script

This is the script I use to run cronjobs on all the sites in a given Drupal installation:


# Drupal sites cronjob runner. Useful to be put into crontab.
# samu 2009-12-06

## --- Configuration ---
CONF_SITES="/usr/local/etc/drupal-sites" # sites list
CONF_LOGDIR="/var/log/drupal-cron" # logs dir
## --- End Config ---

# load sites list, stripping lines that are empty or starting by #
SITES="$(cat "$CONF_SITES" |grep -ve "^$\|^[^A-Za-z0-9]*#")"

# create log directory if not exists
if [ ! -e "$CONF_LOGDIR" ] ; then
  echo " * Creating log directory: $CONF_LOGDIR"
  mkdir -p "$CONF_LOGDIR"

# prepare logfile name
LOGFILE="$CONF_LOGDIR/drupal-cron_$( date "+%Y-%m-%d" ).log"

# Run all cronjobs
echo "--- Drupal ...

Make root log in as postgres user on PostgreSQL

I am writing some backup scripts for a server, and I needed a way to let the root user on the machine to login to PostgreSQL as 'postgres' user to perform some administrative operations.

To do so, I had to make a few changes to the configuration file, to let the root user to authenticate via local-socket without providing a password (the script is launched automatically by cron, no user interaction needed).


local   all       postgres                ident rootaspg
local   all       all                     ident sameuser
host    all       all       127.0.0 ...

Send-only Postfix configuration

I just configured postfix on a machine to send-only mode (just send emails, do not receive). I cut-and-paste the configuration here. Maybe it is not so cool, but it works.


## See /usr/share/postfix/ for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

readme_directory = no

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc ...

« Page 2 / 3 »