Own stuff

How to find the processes using the most swap space in Linux

There's already a good answer to the question at stackoverflow. They suggested to use the top command, then change the sorting field to "swap" by hitting O and p. Unfortunately (afaik) there's no way to do this in batch mode (using the -b switch) and save the top swap using prorcesses in a file. There's another method: use the ps command.
psres=$(ps -eo rss,vsz,user,pid,tty,time,cmd); set -- $(/bin/echo "$psres" | head -n1); shift; shift; echo "SWAP $*"; echo "$psres" | awk 'BEGIN {ORS=""; getline} {print $2 - $1 " "; for (i=3; i<NF; i++) print $i " "; print $NF "\n"}' | sort -rn | head

Mozilla (Firefox + Thunderbird) profile cleaner for linux

It happens occasionally that after a crash (Firefox/Thunderbird or the PC itself) starting up Firefox (or Thunderbird) you experience weird behaviour. Eg. it tells you that the app is already running or it starts, but bookmarks are not available, etc. Cleaning your profile can be easily done manually by removing a couple of files in your Firefox/TB profile, but average users are not familiar with contents of these profile folders. To help them I've written a small app (shell script using Zenity to provide a GUI) that you can put in your Gnome/KDE/etc. menu so all your users can easily access it. Of course, you're free to customize the script anyway you like (eg. take out a few questions to make it even more automatic). I've tested the script in Ubuntu 9.10 (Firefox 3.5.9 and Thunderbird 2.0.0.24).

Display various checksums of files and directory contents in Nautilus

Using the attached Nautilus action, you can easily add a custom action in the context menu of Nautilus and calculate the MD5, SHA1 or CRC32 (as defined by POSIX.2 -aka. IEEE Std. 1003.2- standard) checksum of the selected files and/or for all files in the selected directories recursively. It works with filenames containing whitespace and supports selection of multiple items. By default the results are displayed in a 1000x600 window, but you can easily change that. The action requires zenity to display a dialog box for checksum method selection and display the results.

Notification icon for mounted (aka. in use) LTSPFS devices like USB drives

LTSP uses a FUSE-based filesystem (LTSPFS) for providing access to devices that are attached to the thin client, but are used on the terminal server in the user's session. The creators of LTSPFS took an unconventional approach: users cannot (and are not supposed to) manually eject these LTSPFS mounts, the system does this on it's own after 5 seconds of inactivity (at least it's 5s in Karmic). This is meant to make use of USB devices more comfortable. Unfortunately LTSPFS does not provide any means to the user to detect whether the device is still in use or not. My small modification comes here in play.

Regular calls to Drupal cron.php scripts on a server with a number of Drupal sites

Calling the cron.php of a Drupal site is fairly easy. You just have to put something similiar into your server's /etc/crontab:
0 * * * * www-data test -x /usr/bin/wget && /usr/bin/wget --bind-address 127.0.0.1 -t 1 "http://example.com/cron.php"
Or you can place this wget call in a file in /etc/cron.hourly.

However on a server with quite some Drupal sites (and possibly a number of virtualhosts) the maintenance of these cron.php calls in your crontab becomes very annoying (and it is prone to errors). On a busy development server Drupal sites come and go every day. So why not do these calls automatically? The attached script does just that. Smiling

Website availability/uptime monitoring with Munin

There was already a Munin plugin called wget_page at MuninExchange, but it was very limited in respect of configuration/customization. I've rewritten the plugin with a number of supported options, each can be specified globally or on a per URL basis too. The point of the rewrite was to allow per-URL customization of wget's timeout parameter. In the process I've added lots of other options as well.

Dynamic firewall rules for iptables

Here's the problem: you're allowing access to some ports of your server based on source IPs. This is common practise, even if it's not 100% secure (since source IPs can be spoofed in certain situations). However what if you've no fixed source IP address(es) (which is common practise too) that you can feed into iptables rules? You can register a domain name at a dynamic DNS provider (eg. dyndns.org) and have your client (a DSL router or a client app on your PC) automatically update the IP of that domain name, whenever your client's internet connection get's up. But still, iptables does not allow use of domain names in firewall rules (and it's good so Smiling ). Here's where my script comes into play. It allows you to specify a list of domain names and destinations (host+port) for which the script will automatically generate permitting iptables rules.

Flash Media Server (FMS) monitoring with Munin

Munin is a great open source monitoring program available for a number of platforms. Flash Media Server (FMS) is a streaming server from Adobe aiming mainly at video playback in Flash applications (video players, video conference solutions, etc.). There was already a Munin plugin for FMS (monitoring the number of active connections) at MuninExchange, but the config parameters were hard-coded (in the plugin code) and it lacked documentation on usage and did not match the structure of standard Munin plugins. I've rewritten the plugin to come up for all these shortcomings. The new version of the plugin is available both attached to this post and at MuninExchange.

Picasa Web Albums random photo block in Drupal

There's already a picasa module for Drupal, but if you just want a random photo block and not the complete integration stuff (custom node type and nodes for all the photos), then you might find my module more attractive. Its use is pretty straightforward, set up the block as you'd do with any other block. The Picasa Web Albums user id can be specified in the blocks configuration page (along with a couple of other options).

Automatized online backup of MySQL databases using LVM snapshots

This is again a script that people could write easily if they understood some shell scripting, but it is quite well implemented with logging and all and maybe spares a couple of minutes/hours of your time. Smiling

You should use it with crontab on a daily basis. For details take a look at the desc. of the MySQL backup script.

Syndicate content