January 2009 Archives

22-01-2009 15:14

Incron

Incron is a cron like daemon that you can set up to execute certain tasks when your file system changes. Much like is brother, cron which is based on time to launch events, incron is based on events from inotify from file system events/activities.

So I began playing with this on my Debian server and had a little trouble to begin with. Debian install of Incron, by default, doesn't allow ANY user to use it, including root. So first up, one need to add the user you want to have access to the incron daemon to /etc/incron.allow file. It is originally blank. Mandriva I found didn't use this system; /etc/incron.allow did not exist and all users had access.

To add an entry in a users incrontab you simply to like you would for cron.

incrontab -e

And then add like example below

/root/test IN_MODIFY touch /root/testing

Right, all looks good now. Hmmmm try editing with VIM and saving a change to /root/test and /root/testing has an up to date time stamp. Wait another min and do it again and no change to /root/testing. Hmmmm a bit of searching found this thread. incron loses track of files edited by vim. This thread suggests its to do with some editing [I assume vim included] use a temp file when editing. So I changed my lines event from IN_MODIFY to IN_ALL_EVENTS and we have lift off [so far...]

The other issue I found was if you can add system wide. I found, through experimenting [and this issue above made this hard to begin with] that you can add files into /etc/incron.d/ that contain line entries matching the format of above and the system will run them.

Incron is a terrific daemon service that I am going to look at implementing into my servers in other ways. It just needs a little better documentation, but not too bad, mostly me trying to do this while doing other things.


Posted by DaveQB | Permanent Link | Categories: IT

20-01-2009 18:28

Listed installed packages in Debian

The other day I needed to list packages I have installed that were associated with MythTV on my MythTV box runing Ubuntu 8.04. So all using ssh and bash. I looked at the dpkg man pages was dispointed I could not find a switch that would only show installed packages. So with a bit googling I surprisingly could not find a quick one liner for this. So I set out to make my own.

To list packages with dpkg is simply:

dpkg -l <search sting> 

Easy enough. But that lists packages with all different status. So to narrow that down we pipe to grep and use a regex [regular expression] to show only lines that begin with 'ii', the status of installed.

dpkg -l "*myth*" | grep -e "^ii.*"

What we have done here is list all packages dpkg is aware of that contain "myth" in their names. Then we pipe that to grep and tell it to use the regex of "^ii.*" on it by using the grep switch of -e. ^ means the start of the line, ii means the literal characters, 'ii' and .* means anything after it.

For more info on regex, just do a handy search on your prefered search engine, there is lots of info out there on how to use this powerful tool.


Posted by DaveQB | Permanent Link | Categories: IT

19-01-2009 11:18

Public Enemy Sydney 2008/09

My girlfriend surprised me with tickets my favourite musical group of all time, Public Enemy. We went to the Sydney concert on the 27th, the one my girlfriend got tickets for us, and then we also we to the Newcastle show on the 3rd of Jan 09. It was such an AWESOME experience!! We got into the front row in Newcastle! Here are the links to the gallery of these events.

Sydney Dec 27th 2008

Newcastle Jan 3rd 2009


Posted by DaveQB | Permanent Link | Categories: Personal

11-01-2009 04:52

copy files in Alphanumeric order

Odd title for a post you say. Well to explain it better. My car Stereo and now my girlfriends new MP3 player play back files, [mp3's] in a folder, in the order in which they were copied, timestamp. So both Windows and Linux [tried both cp and konqueror] copy files in "any old order" it seems and not Alphanumeric order, thus preserving the name order of tracks for an album. I have been copying each file, one at a time to get around this, but have finally written a script that uses kdialog and a servicemenu for Konqueror so one can easily right click a folder to then copy to their mp3 player by picking the destination folder in the ensuing dialog box.

You can find it in my software section software. Its called kopy-0.1.tbz2. Please report any suggestions or major bugs. It was whipped up quickly tonight.


Posted by DaveQB | Permanent Link | Categories: IT

08-01-2009 18:26

Copy all files and folders but exclude some.

The cp command, in my opinion, should have an exclude switch available to it. I find myself needing to copy everything but a file or a folder and cp can't handle this requirement. So with a bit of googling around and testing, I have a way to do it. To copy all in the current folder to "bar/" excluding any folder or file called "foo", we do this:

for i in * ; do if [ "${i}" != "foo" ] ; then cp -r "${i}" "bar" ; if ; done

If you need to exclude a few files and folders, simply add in an AND operand and the value, like so:

for i in * ; do if [ "${i}" != "foo" ] && [ "${i}" != "example.txt" ]; then cp -r "${i}" "bar" ; if ; done

I didn't error check that, just did it from memory, so I hope it works for you.


Posted by DaveQB | Permanent Link | Categories: IT

07-01-2009 02:19

Awk one liners explained.

Everyone has needed and used atleast one of the 1 liners in the famous awk1liners.txt "cheat sheet" text file. But not all of us would know exactly how the line you needed and used worked. Well here is a 3 part series on explaining them. I have not read it yet, but looks promising.

http://www.catonmat.net/blog/awk-one-liners-explained-part-one/
http://www.catonmat.net/blog/awk-one-liners-explained-part-two/
http://www.catonmat.net/blog/awk-one-liners-explained-part-three/


Posted by DaveQB | Permanent Link | Categories: IT

06-01-2009 16:33

Yo Frankie!

A FOSS 3D game released by the Blender Foundation and obviously written in Blender. Yuo can apparently edit the source whilst playing if you open it in Blender. Main Site and Download site.


Posted by DaveQB | Permanent Link | Categories: IT

05-01-2009 11:08

FOSS Helpdesk software

Working on a Helpdesk, I see the importance on good supporting tools and the kind of costs companies are willing to spend on these things. If I had it my way, we would do away with proprietry, costly, slow to change software and use a FOSS package and in house coding to improve as we need it. Here is a pretty good list of whats out there

http://www.opensourcehelpdesklist.com/


Posted by DaveQB | Permanent Link | Categories: IT

04-01-2009 22:55

Rendering Animations in Blender

Something so simple, but had me scrambling for google! Link to the page in the manual that is relevant.


Posted by DaveQB | Permanent Link | Categories: IT