Redmine logoI’ve recently transfered all my project planning, development, bug ticketing and repositories to the awesome Redmine project tracking software. From now on all of my development work will live on tracking.42dev.eu

 

To facilitate bug reports and feature planning for my latest WordPress Plugin I’ve activated user registrations in Redmine, so people can post messages on the Forums. Now I wanted to have some sort of mechanism to delete unwanted users from the Redmine database. Since the software has no such option on the webinterface I searched for an alternative and found one on the Redmine forums.

Go to you Redmine install directory and enter the following (substitute USER_ID with the desired value):

>> script/console
>> u = User.find(USER_ID)
>> u.destroy

Make sure, that the user you are deleting doesn’t have any activity on the site yet, otherwise problems could arise, if the user already posted messages etc.

Another entry in my virtual “braindump” category, so I don’t have to look it up somewhere else all the time.

If you want to periodically delete files in a specific directory the unix program find comes to the rescue. In my specific case I needed to delete all the movie files from a surveillance camera that where older than 30 days.

This is the crontab entry to accomplish that:
0 0 * * * /usr/bin/find /videos/ -type f -name '*.avi' -mtime +30 -exec rm {} \;
(everything in one line)

The code runs the program /usr/bin/find every day at midnight (0 0 * * *). It checks the directory called /videos for everything that is a file (-type f), has a name that ends in .avi (-name '*.avi') and is created 30 days ago or before that (-mtime +30).
The command then executes rm (remove) on all those files (-exec rm {} \;).