Daemon in PHP
PHP is my first choice scripting language. I know it bottom up and everything from file manipulation to network connections can be done both easily and effectively. In the past year or two, the PHP core dev team managed to remove all memory leaks I encountered during writing of long running scripts. Thanks to that, I could start writing background running task scripts in PHP. I used an implementation in Python to get the basic skeleton working and subclassed my scripts from it. You can do exactly the same!
Usage
composer require vvondra/php-daemon
Save the code above as sleeper.php
and then just make the appropriate calls:
php sleeper.php start php sleeper.php stop php sleeper.php status