Sometimes you want to separate old files (for example older than 30 days) into separate subdirectory to make navigation easier. Using Linux tools it’s pretty easy task:
mkdir -p OLD; find . -maxdepth 1 -mtime +30 -exec mv \{\} OLD \;
Explanation:
- mkdir -p OLD: create OLD subdirectory if not exists
- -maxdepth 1: search only one level under current working directory
- -mtime +30: find only files that are older than 30 days
- -exec …. \;: for every file/directory found execute the following command
- \{\}: will be replaced by filename
Above command will move all old files/subdirectories into OLD subdirectory.
Recently I forgot to add #reviewthis directive for modifications of codebase that belongs to team A. And a subtle bug was introduced that way. Ops! I agreed earlier that all changes done to moduleB should be passed to a reviewer that will do peer review for that particular change. What a shame
(We are using excellent GitHub’s review mechanism, BTW).
How to avoid that situation in a future? Should I rely on my memory? Is it possible for a human to track so many small rules manually? My intuition tells me that enforcement of those small ruleset should be automated.
GIT allows you to specify so called “commit hooks” that can validate many stages of GIT workflow. I’ll use simplest local verification of commit message, first the rule in plain text:
If you are changing moduleB you should notify developerC about this change
(more…)
The simplest way to monitor free disk space on Linux serwer, just place it in crontab:
0 8 * * * df -h | awk '/^\// && $5 > 95 { print "missing space", $0 }'
and ensure e-mail to this user is forwarded to you then you will see e-mail when occupied space is higher than 95% on any disk.
Pretty simple.
Current project I’m working on benefits from automated test suite run on few Linux-based devices. Tests are running 24×7, but sometimes device hangs (reason is still under investigation) and SSH access is blocked then.
In order to track the problem I redirected syslog (busybox-based, BTW) via network and added local automatic monitoring service that will show me when a part of my test installation go down.
(more…)
I’ve been assigned recently a task to prepare development process for two teams that are working on separate version control systems (GIT and Perforce in my case). One of important parts of this task is to create effective method of syncing codebases between both storages.

Of course we have git-p4 tool, but my requirements are a bit complicated for this tool:
- Only subset of whole GIT repository will be stored in P4
- GIT repository already exists with some history (the same for P4)
so I decided to write small script that will do at least P4 -> GIT sync.
(more…)