Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about sysadmin (old posts, page 8)

Why no packaging software should replace your config files

When you up­grade a piece of soft­ware on Lin­ux, there are two paths it can go when there are in­com­pat­i­ble changes in the con­fig files (ok, 3 path­s, De­bian asks you what to do):

  1. The "rp­m­new" way: in­­stall the new con­­fig file as "what­ev­er.rp­m­new", which means the soft­­warewill break im­me­di­ate­­ly, but that's ok, be­­cause you are do­ing up­­­grades, so you should be watch­ing al­ready.

  2. The "rp­m­save" way: re­­place the old file and save a copy as "what­ev­er.rp­m­save".

This has two prob­lem­s:

  1. The soft­­ware may fail or not, or fail in a sub­­­tle way, and you will not no­tice right away.

  2. Maybe the old file will be lost any­way:

    lrwxrwxrwx  1 root root 32 jul 15 22:41 /etc/named.conf -> /var/named/chroot/etc/named.conf
    lrwxrwxrwx  1 root root 32 jul 15 22:36 /etc/named.conf.rpmsave -> /var/named/chroot/etc/named.conf

In this case the "file" was a sym­link, so by "sav­ing a copy" it on­ly saved an­oth­er sym­link to the soon-­to-be-over­writ­ten file.

And that's why, ladies and gen­tle­men, the rpm­new way is the good way.

Adding MSN notifications to Argus

I am a us­er of Ar­gus as a mon­i­tor­ing soft­ware. Since it's very flex­i­ble and easy to ex­tend, I want­ed to add MSN alert­s, the same way I had added SMS alerts a while ago. It was eas­i­er than I thought!

  1. In­­stall msnlib

  2. In­­stall the ex­am­­ple msnbot, mod­­i­­fied so do_­­work is like this:

    def   do_­work():       """      Here you do your stuff and send mes­sages us­ing m.sendms­g()      This is the on­ly place your code lives      """         # wait a bit for ev­ery­thing to set­tle down (sync tak­ing efect       # ba­si­cal­ly)       time.sleep(15)       for   d   in   sys.argv[3].split('+'):               print   m.sendmsg(d,msg)           # give time to send the mes­sages       time.sleep(30)         # and then quit       quit()  
  3. De­fine a cus­tom no­ti­fi­ca­tion in ar­gus like this:

    Method "msn" {
       command: /usr/local/bin/msnbot alerts@mycompany mypass %R >/tmp/XXX 2>&1
       send: %M\n
  4. Wher­ev­er you want MSN no­ti­fi­ca­tion­s, add this (on no­ti­fy or es­ca­late di­rec­tives, us­ing as many guys MSN ad­dress­es as you need):

That's it.

Wine kinda works nowadays

I had stopped try­ing to run stuff in WINE a few years ago,be­cause pret­ty much noth­ing worked.

You know what? They areright about ap­proach­ing 1.0, I had to try a few win­dowsy things late­ly, and each one has worked just fine.

Ku­dos wine peo­ple!

PS: can you make the wid­gets look less ug­ly, though? I heard ru­mours of a them­ing en­gine, but have no clue as to where one would look. Even some­thing like GTK's clear­looks would be bear­able.

Pop quiz!

Q: What hap­pens if you have a SMT­PA server, and you have a us­er called in­fo, and then set its pass­word to in­fo?


[root@victim ~]# qmail-qstat
messages in queue: 151369
messages in queue but not yet preprocessed: 9


  • Yes, there is a rea­­son why those pass­­words are not avail­able by de­­fault.

  • I re­al­­ly should lim­it the per-ac­­count out­­­go­ing mail by de­­fault in all server­s. Let's start work­ing on it.

Linux as a windows crutch: Sending SMS

Sup­pose you want to send SMS mes­sages from win­dows through a blue­tooth con­nec­tion to a phone.

I am sure you can make it work. On the oth­er hand, I al­ready had it work­ing on Lin­ux... so you can just use this on a friend­ly Lin­ux box, and send SMS mes­sages by ac­cess­ing a spe­cial URL:

#!/usr/bin/env python
from colubrid import BaseApplication, HttpResponse, execute
import os

class SMSApplication(BaseApplication):

  def process_request(self):
      numero = self.request.args.get('numero')
      mensaje = self.request.args.get('mensaje')
      [entrada,salida]=os.popen4('/usr/bin/gnokii --sendsms %s'%numero,mode='rw')
      response = HttpResponse(msg)
      response['Content-Type'] = 'text/plain'
      return response

if __name__ == '__main__':
  execute(SMSApplication,debug=True, hostname='mybox.domain.internal', port=8080,reload=True)

If someone opens http://my­box.­do­­ter­nal:8080/?nu­mero=1234?­men­saje=ho­la%20­mun­do it sends "hola mundo" to the 1234 number.

I sup­pose I could call this a web tele­pho­ny ser­vice or some­such, but it's ac­tu­al­ly just the 5'­so­lu­tion that came to mind.

It us­es a sil­ly lit­tle not-a-we­b-frame­work called col­u­brid in­stead of some­thing you may know, be­cause I want­ed to keep it sim­ple, and it does­n't get much sim­pler than this.

Contents © 2000-2023 Roberto Alsina