Backport "Unit tests for shell scripts and fixes"
Some work has been done in development
branch in order to add unit testing for shell scripts and in that work some wrong shell script code has been fixed. In particular the lock mechanisms used by backups has been fixed.