As setting up Puppet server and agents using VMs provided by Puppetlabs is simple as shooting fish in a barrel, setting it up on actual servers may be a little more annoying. Continue reading Puppet common errors
Bacula by default is backing up all symbolic links as… well, symbolic links. It does not follow them and there is no option for FileSet to make it do that.
However you can make it follow symlinks to directories and back up files located somewhere else.
Example File entry:
File = /some/directory/symlink_to_dir/.
To follow and backup symbolic links file targets, you’ll have to use a trick described in my previous post – Including files from file on client machine, plus use a bit find-fu:
find /dir/to/search -type l -name "*" -printf "%l\n"
Just remember to have symlinks pointing to file using full paths, eg. /home/user/backup_me.tar.gz
Including files to be backed up from file is not a killer feature of backup software, but it’s very useful when you need to backup only set of files from large directory structure.
Using Bacula makes that a bit more complicated though because of its divided structure (Storage Daemon, File Daemon and Director). Director tells File Daemon which files to back up and where to send them, that’s why Director must know which files must be backed up. Continue reading Bacula: Icluding files list from file on client machine
Bacula is somewhat complicated backup system, but once mastered, it’s extremely convenient and comfortable solution. Still, adding new clients can be a pain if you don’t have a “standard” file set. Tuning it may take a long time, but there’s a way to make it a bit easier for you. Continue reading Bacula: List files that would be backed up using bconsole
Adding lablel to any course is a very simple operation. Label is the most basic element you can add to a course body in Moodle (next to course sections or descripions). Label is basically some text usually surrounded with some html to add formatting. And it does nothing more. You can add, move it or delete it. That’s it.
Altough it’s simple to click around and add an element, adding it automatically on the other hand can be a tricky business. If you do something wrong, you can break course (best case) or mess up whole Moodle database almost beyond repairing (worst case scenario). Continue reading Moodle: Adding label to a course using code
A quick hint how to drop all tables from MySQL database. Useful when you’re not allowed to drop and recreate database (or it’s not a good idea).
The idea is simple: backup database without any data, only tables, and pipe output back to MySQL with filtering out all create table statements.
mysqldump -u USERNAME -pPASSWORD --add-drop-table --no-data DATABASE_NAME | grep ^DROP | mysql -uUSERNAME -pPASSWORD DATABASE
If you remove grep from above command, you’ll recreate all tables from scratch (drop table and then create table).
mysqldump -u USERNAME -pPASSWORD --add-drop-table --no-data DATABASE_NAME | mysql -uUSERNAME -pPASSWORD DATABASE
WARNING! It will remove all data! You won’t be able to restore them unless you have backups.
You have been warned.
I know that backing up databases is a job for a sysdamin. I know that I shouldn’t do that because I’m a stupid developer. I know that. I just couldn’t resist… And then I came across a strange error that sysadmin never encounters (you know… mysqldump -u root…). I couldn’t dump this db due to events error. So here is a quick solution for that.
mysqldump: Couldn't execute 'show events': Access denied for user 'user'@'some-host' to database 'dbname' (1044)
Below lines are solving that. The magic option here is –skip-events
mysqldump -u usernam -p --skip-events --databases dbname > dbname_dump.sql
mysqldump -u usernam -p --skip-events --single-transaction --databases dbname > dbname_dump.sql
Moodle forms are built on top of PEAR QuickForm lib with some non standard js code and other extensions and modifications. It’s dead simple to generate some standard html forms, but when you have to do some tweaks to it, you’ll have to break some sweat and time. Continue reading Moodle: modify form elements before displaying the form
Here’s a solution I’ve used a long time ago when I maintained shell server. It was very customised Debian box with custom kernel and many other fancy things. One of solution I used was logging out inactive users after certain amount of time. They were using limited resources (512 MB of RAM isn’t much) and we didn’t want them to do that if they weren’t using shell. Continue reading Bash: Automatically logout inactive users
Without any further descriptions: everyone knows diff tool. This command is checking if files are the same or different in two directories. Continue reading Recursive diff with crap filtering