Sep 192014

Had a situation at $WORK where network connections were just hanging there, open, with no activity. So I needed to send something, whatever, on the open connection, just to see how it behaves.

TL;DR: attach to the process using the debugger, gdb(1), then call send(2) on the network socket
Continue reading »

Sep 152014

In order to take advantage of shared clipboard, seamless integration and drag&drop features of VirtualBox two things are needed. First, the guest additions need to be installed, pretty straight-forward in most distributions. Second, VBoxClient needs to be started. This depends on desktop environment and distribution, some start it from the get-go, others don’t. If it’s started, it should show in the list of processes. If it isn’t, there’s a script that starts and enables all features, it’s called VBoxClient-all. Just add that one to the startup list of the DE.

Aug 262014

Short demo script in Python that monitors the VPN tunnels in Amazon Web Services. It queries the current state every 1.5 seconds in a loop and if the state changes it writes the new state to a log file. Needs the boto library.

Feb 242014

My ideea was to set up a script running on Google’s servers that would automatically get files from my site and back them up on Google Drive. I would have gotten a free off-site backup. Unsurprisingly, it’s not working due to limits imposed by Google, even though I did manage to cheat on the 10MB limit for UrlFetchApp and file creation. Instead it now fails either because it’s execution takes too long, or because it tries to write to Drive too many times in a short period.

Some basics first.

What is Google Apps Script? JavaScript based, it can be used to make Google’s cloud do stuff for you. Basically web apps can be written that run on Google’s servers and use Google products like Maps or Calendar.

What is Google Drive? (Really?) It’s a site where people can store files. 15GB for free. Like Dropbox.

There are limits though and they are set pretty low. Understandable, as it would be easy to abuse otherwise. Like, for example, the maximum size that can be fetched from an URL is 10MB. The maximum size of a file that is created via scripting is also 10MB. Not really useful for backups.

Right. On to the actual script and why it (still) doesn’t work.
Continue reading »

Feb 232014

I’ve been using this shell script to backup my WordPress site and database for a while. There is nothing WordPress-specific in it though, the script can be used for anything that uses a database. It creates a MySQL dump of the database and a ‘ls’ of the site directory, compares then to the last ones and creates a new archives of each of them if something has changed. What it doesn’t do is move those files off-site for an actual backup.

Works for small sites, like this one. Dumping the whole database just to see if anything changed might become an incresingly worse idea as the site grows. Use common sense, run on a slave for bigger setups or something.
Continue reading »

Dec 302013

When trying to upgrade an official module, puppet complains that it can’t find it on the forge. It might actually be that it doesn’t recognize the SSL certificate as being valid. When trying to install a module from, it returns the proper error, complaining that the certificate is invalid:

Apparently https is a jerk, so, other than the obvious, a solution is to use http instead of https for the repository:

On FreeBSD it might be that /etc/ssl/cert.pem isn’t symlinked to /usr/local/share/certs/ca-root-nss.crt, where the ca_root_nss package installs.

Nov 182013

Problem description: attempting to start Zabbix agent in a FreeBSD jail fails with similar output to Zabbix’ log file:

Quick solution:

WARNING: Enabling sysvipc for jails can be dangerous to the system’s health

Set jail_sysvipc_allow="YES" in rc.conf on the host:

Continue reading »

Jun 062013

… but everything is set up properly. Check if there is anything under /proc/fs/nfsd/. If there isn’t, run

Apparently it happens when NFS support has been compiled into the kernel, but the userland tools have been built on a kernel where NFS is loaded as a module.

Another possible issue is if the server can’t resolve the client’s hostname. Might depend on NFS version. The client sends it’s hostname with the request, if the server can’t resolve it because it doesn’t have access to a DNS server for example, it might not allow the client to mount. First obvious solution is to make sure DNS resolution works properly, second obvious solution is to add the host to server’s /etc/hosts file. Third solution is less obvious, make sure there is no DNS server to interrogate. If there is nothing in resolv.conf to time out, the server will allow the connection, even if it can’t resolve the hostname.