What is Bacula?

Bacula is an open source backup solution. It’s known to be robust enough but yet relatively easy-to-configure. As it is open source, software license costs are nullified. Also a proof to its stability, it’s RPMs and DEBs are to be found in software repositories of the most popular Linux server distributions, Red Hat (CentOS) and Debian, so installation and deployment of upgrades can be done in a common way by anyone. Bottom line, Bacula has its flaws, but it’s still likely better than fooling around with rsync based scripts and catalogues. Continue reading “What is Bacula?”

Advertisements

How to limit memory usage of a process under Linux

In various cases a process can easily eat up the memory of a server. This can happen fast and slowly(within weeks) as well. This article will show you how to find this process and how to limit its memory usage. The Linux itself does not limit the physichal memory usage of a process, either running under root privileges, or not.

Continue reading “How to limit memory usage of a process under Linux”

Starting and keep running reboot persistent autossh on unix-like systems without root rights

Basic scenario

There are systems:

  • – which can’t be accessed from the public internet. E.g. behind ipv4 NAT and DMZ isn’t an option.
  • – which shouldn’t be access directly from the public internet. So firewal or other access control not suitable.

Solution

I wrote a simple shell script securing continuous running of autossh on unix-like systems.
The script is started by cron in every minutes, so no root rights is required. Allowed cron is necessary for your local user. I didn’t used @reboot because this crontab directive isn’t implemented on many Unix systems.
Autossh secures monitored ssh connection which opens a reversed ssh tunnel. If the connection losts it will be restarted by autossh.

The sshd is listening on the 22022 local port ot the host “sage”. So the my systems can be accessed only via local account of server “sage” which can be accessed from everywhere on the net.

The script

#!/bin/bash
#set -x

HOST=”sage”

AUTOSSH_PATH=”/usr/bin/ssh”
export AUTOSSH_PATH

AUTOSSH_PIDFILE=”/home/miam/bin/autossh.pid”
export AUTOSSH_PIDFILE

PIDFILE=”$AUTOSSH_PIDFILE”
AUTOSSH_CMD=”/usr/bin/autossh”

call_autossh ()
{
“$AUTOSSH_CMD” -M 22023 -N -R 22022:localhost:22 -f “$HOST”
}

self_check ()
{
if [ -f “$PIDFILE” ]; then
PID=`cat “$PIDFILE”`
kill -0 $PID
if [ $? -eq 1 ]; then
return 1
else
return 0
fi
else
return 1
fi
}

self_check
if [ $? -eq 1 ]; then
call_autossh
fi

The crontab entry

* * * * * /home/miam/bin/autossh.sh >> /home/miam/bin/autossh.log 2>&1

The repo

The code can be cloned from github:
https://github.com/miam/keeprun/tree/v0.1

Home-office – anywhere

OS in a pocket

This article will not contain any highly sophisticated scripts, tricks or whatever like that. But I decided to write it because I was in hard situation sometimes due to absence of my home PC or powerful laptop. There was a PC at the place where I was at the moment but I wasn’t able to log on, there was no necessary software installed, etc. So I wasn’t able to help my colleagues, friends or whoever.

I had problems even at home with an old laptop (Celeron 1.3 GHz; 512MB RAM – really old) which is used sometimes by my wife who don’t  want to change the operating system on that to something else than the good old XP. So I decided to deploy my own operating system working almost everywhere, and fitting in my pocket. Continue reading “Home-office – anywhere”

Checking the age of a file – Perl in monitoring

An unusual monitoring request

Some time ago we – at the monitoring team got a bit strange request: Check the time when a file was written last time. If the modification time of it is older than “x” minutes, rise a warning message in the monitoring system.

Although, it is kind of indirect monitoring, it can be really relevant regarding the health of an application which is known to write information into a file at known regular intervals. Continue reading “Checking the age of a file – Perl in monitoring”

IT at home – Connect a TV set with Ethernet to the home wireless network

I bought a new TV

It was a surprise even for me… I just wanted to get some information about the offer at the moment on the market. However, I found a device which was on sale, and fulfilled most of my wishes: full HD, brilliant picture quality, and what was the most important, ability to connect to the TCP/IP network.

As it usually happens, taking the TV home and switching it on rose completely new questions. How to connect it to the network at my home, if network devices in my home are located in my small working cabinet, which is in the other part of the flat? And, in general, how to build a second “IP island” at home? Continue reading “IT at home – Connect a TV set with Ethernet to the home wireless network”

Perl exercises shortest route between two towns

Introduction

I will present some of the exercises I got from my perl programming mentor. These exercises helped me to get more in depth with perl, and learn the mechanism behind the language.  You can try to solve these exercises also on your own, to improve your skills.

My solution is only one way to solve it. A problem has unlimited number of solutions, and if they all accomplish the task, they are all correct.

Usually I will first write the specification I got, then I will show my solution and also give some explanation.
Continue reading “Perl exercises shortest route between two towns”