How to copy only directory structure

For example you have defined directory structure with a lot of files. And task to copy only directory structure without files. So, How to copy only directory structure ?

Let’s copy directory tree from old_tree to new_tree:



Read more

Random byte generation in PHP

Here is my small 5 minute php script for random byte generation.

Could be useful for checking your random numbers quality. 🙂

Read more

Wait for MySQL service in loop

I have no mysql client except php mysql driver on application node, that’s why small mysql ping script have to be done. Small sample here :

You can set execution bit by:  chmod +x mysql_ping.php Let’s run mysql_ping in loop: while ! `./mysql_ping.php`; do sleep 1; done && echo 'MySQL is alive' Results when MySQL server is down:

Successful Results:


Read more