Linux: how to manage tasks using supervisor
Linux manages tasks using supervisor While you are using the VPS environment much time in this environment several small programs that you want to run on it continuously.
Either is small shell scripts or any huge sized packages usually you can write an init script on it but it takes a lot of time but they are also not glassy for the new users
The supervisor is known as a process manager it provided a continual interface to the long-running programs.
And makes them an easy task for them by which they can manage and monitor more easily.
Hopefully if are reading this article then you must be familiar with the command line.
Basic server management, and packages.
If we talk about the installation of supervisor for Linux and Ubuntu then this is just too simple because the rebuilt packages already exist there with both distributions.
If the root user wants to install the supervisor then there is a need to write the below command.
When this one completes then also the daemon should start before.
Because the rebuilt packages come with the init script that will make sure that after rebooting the system restart.
The supervisor can ensure it by running the below command.
The supervisor installs here now we will check it by adding our program.
Adding the first program:
The new programs are given through configuration files to the supervisor which make the executable run and how its output should handle.
Now for this article, we are going to assume here that.
We have a shell script and want it to run continuously saved in /usr/local/bin/long.sh I will look like something like
The program actual configuration files of the supervisor program are present in /etc/supervisor/conf.d directory.
And the simple configuration of the script saved at /etc/supervisor/conf.d/long_script.conf, is going to look like this:
Some of the desirable tweaks are below for your program.
From the name of ‘long-script’, the configuration defines the program and the full path to the program.
Here the next two lines tell the automatic behavior of the current script under some definite conditions
Autostart tell the supervisor when the system will boost the program should start in the meantime
Auto-restart defines it under three conditions false, true, unexpected, and how the supervisor going to manage the program in it.
And after all of this, the final lines will tell the location of the files for the program here.
Once the file creates and after saving then there is a need to inform.
The supervisor of the new program from the command supervisorctl and then tell the supervisor to check the update for the configuration of the program in /etc/supervisor/conf.d directory:
If want to make any changes in the program configuration then you can make it by using the previous two commands here:
If you want to buy $1VPS hosting and a cheap dedicated server then www.cloudsurph.com going to be the best choice for you.
I hope this information gives you a small insight into Linux!