Long lived Python/PHP daemon-script-wrapper with Supervisor instead Cron schedules

All novice Linux users and seasoned sysadmins know that Cron is a great simple solution to the problem of regularly calling the same application, it is present in almost every Linux system, has simple syntax and a number of logging and warning functions that make it a great addition to system administrator tools.

However, the Cron solution has some limitations.

  1. The minimum time is limited to 1 minute – this is the shortest repeating interval that you can configure.
  2. Minimal support to avoid concurrency.
  3. It almost completely ignores the state of the command being called, that is, if the script fails, Cron will just keep trying (as it should), and you, as an administrator, should check and diagnose the problem.
  4. But what if you need to implement a robust “long-lived” application in Python or PHP?
    Not everything can fit into convenient 1-minute time intervals for program code execution. In addition, there is an unnecessary overhead for loading the required libraries and opening file and socket descriptors each time the program is called for execution.

What if your application code needs to maintain a connection to a remote server and respond to events on an ad-hoc basis? Probably someone will say that these are already full-fledged demon programs. But the line between a daemon and a long-lived application in scripting languages ​​is not very clear.

“Long lived Python/PHP daemon-script-wrapper with Supervisor instead Cron schedules”Continue reading

Protected: Openstack: daemon for collecting statistics of billing SWIFT storage based on supervisord with threads.

This content is password protected. To view it please enter your password below:

Openstack CLI: Unset all variables beginning with prefix OS_

When using the Openstack CLI, you typically will get a shell script that you would source, which will export a bunch of variables to your session. I have run into the problem of switching between two different Openstack installs that were on different versions, and needed different variables. Also you will be need this when you will be generate parameters in different areas of scope for last version of keystone. Accordingly, the following example will unset all Openstack variables (all variables that begin with OS_)

Need create file reset_OS.sh with next content:

# ${!varprefix@} Matches all previously declared variables beginning with varprefix
unset ${!OS_@}

and use in next manner:

$ . ./reset_OS.sh

Protected: How to Install KUBERNETES Cluster ON CENTOS 7/8 – Complete Guide

This content is password protected. To view it please enter your password below:

QEMU/KVM: Changing the default connect URI in libvirt

All the libvirt related commands, like virsh, virt-viewer or virt-install take a connect URI as parameter. The connect URI can be thought as specifying which set of virtual machines you want to control with that command, which physical machine to control, and how.

For example:

virsh --connect "qemu+ssh://super@servers.arcade.click" start node011

“QEMU/KVM: Changing the default connect URI in libvirt”Continue reading

Scroll to top