Monday, February 13, 2012

Mondo Rescue: Using the post-nuke script

Quoting from their site
"Mondo Rescue is a GPL disaster recovery solution"
and have been used in several installations we have performed for our customers. One of the useful option is to exclude some directories (for example /var/log) and this means that all files and sub-directories will not be saved into the archive. This is good as it will save a lot of space but not very good to your system trying to write into an non-existent folder (like /var/log/asterisk).
The way to work around this problem is to use the "post-nuke" phase, when the control is transferred to a post-nuke script. If you will try to find some information about this feature the result is very disappointing as it is mentioned briefly only in the mondoarchive man page
-P tarball
Post-nuke tarball. If you boot into Nuke Mode and everything is restored successfully then the post-nuke script will be sought and executed if found. This is useful for post-restore customization. It is assumed that the tarball (.tar.gz format) will contain not just the post-nuke script (or binary, or whatever it is) but also any files it requires.

The way to solve the dilemma is to create (just before running mondoarchive) an archive with the hierarchy for the needed directories (for example for all of the directories you have excluded with -E). The hierarchy is obtain with find command and should provide a safe way to save all your sub-directories (including the symbolic links). The archive is created using tar command, which will save their owner, group and mode bits.
You could find here here an archive with the post-nuke script (to be placed in /root for example) and an example for the backup script.
The work was based on the post-nuke sample script (located in /usr/share/mondo/post-nuke.sample) and the information found in the Mondo-Devel mailing list archive (mainly this post).

Update #1: location for the archive example have been changed

Thursday, January 19, 2012

Linux: power off confirmation

There are situations when you need to configure your Linux machine to be powered off when somebody shortly press the power button. This is usually the case when you will install acpid (Advanced Configuration and Power Interface event daemon).

But what if you need some sort of confirmation that your command have been received and the system is in the shutdown cycle?

Well, all you have to do is to tweak the action parameter from /etc/acpi/events/power.conf and my suggestion could be found bellow.

Let's take a Centos or any RHEL based distribution and test it!

yum install acpid

in /etc/acpi/events/power.conf:

  • comment the default action (inserting # as the first character of the line)
  • add the following line at the end of the file
action=/bin/ps awwux | /bin/grep gnome-power-manager | /bin/grep -qv grep || (/bin/echo -e \\a >> /dev/console;/bin/sleep 0.25;/bin/echo -e \\aPower button event ! >> /dev/console;/bin/sleep 0.25;/bin/echo -e \\a >> /dev/console;/sbin/shutdown -h now)

All we have now is to restart the acpid service:

service acpid restart

In this way, when the case power button will be pressed shortly, 3 short beeps will be heard (in case your machine have an internal speaker) before the final shutdown command is triggered.

Sunday, December 18, 2011

Are we still accepting incoming SIP calls?

Intrebarea de mai sus mi-a fost pusa acum cateva zile de unul din colegii mei si i-am raspuns ca din cate stiu ar trebui sa functioneze.

"- Si cum testam?" a venit continuarea fireasca...

Fiind prins am evitat un raspuns direct dar stiam ca nu pot sa las intrebarea fara raspuns, astfel incat documentez mai jos modul in care se poate face testarea unui astfel de scenariu.

  1. se creaza un cont pe OpenSips
  2. se instaleaza X-Lite, Zoiper sau alt softphone care permite apelarea unui SIP URI
  3. se configureaza in softphone contul OpenSips creat la pasul 1
  4. se verifica inregistrarea contului
  5. se apeleaza numarul dorit (de exemplu sub forma [numar]@[sip_server])
    Observatie: in Zoiper apelarea trebuie facuta sub forma sip:/[numar]@[sip_server]
Happy testing !

PS: daca testul de mai sus vreti sa-l faceti din reteaua interna s-ar putea sa nu reusiti inregistrarea softphone-ului la OpenSips din cauza unor restricitii care ar putea exista in firewall. De aceea caut in continuare o metoda si serviciu (free of course) care sa fie folosite "din browser".