FTP down regularly, I wish a script who monitor his health and restart if needed

  • Hi,
    All is in the title ^^
    I use the FTP service provided with OMV 4 and sometimes I found it down, the service is ENABLE but STOP, I can fix it with command : "service proftpd restart" but I wish to script a monitoring who can restart it itself if needed.
    Can someone help me please ?


    Greatings at all. :)


    Bonjour,
    Tout est dans le titre ^^
    J'utilise le service FTP fourni avec OMV 4 et parfois je le retrouve stoppé alors qu'il est toujours actif. je peux régler le problème ponctuellement en tapant cette ligne de commande "service proftpd restart" mais j'aimerais créer un script de monitoring qui ferait le travaille lui-même.
    Quelqu'un peut-il m'aider s'il vous plait ?


    Mes remerciements à tous :)

  • In the first place, it would be better to check why this is happening because it is not normal.


    You can write a simple script that will check if the process is present. Or do it in the style of the Middle Ages. Every hour, do the cron task. In this case, even if it is ok, it will carry out a preventive restart.

  • So after doing some research I found a simple but effective way to achieve this action.I was inspired by the tutorial here that I adaptedFor those who do not have the knowledge here are some explanations:


    1) One creates a script which checks the state of a program, in the example it is the daemon mysql, me I replaced that by proftpd.Obviously I checked the location of the program and its syntax otherwise it does not work.


    2) We use cron to periodically launch this script by changing the location and the name of the script of course.


    So we have cron that starts the script every 5 minutes, this script checks that proftpd process turns, if it is the case it does nothing else it starts it.


    I tested and it's the job it's great.



    Alors après avoir fait quelques recherches j'ai trouvé un moyen simple mais efficace pour réaliser cette action.
    Je me suis inspiré du tuto ici que j'ai adapté


    Pour ceux qui n'auraient pas les connaissances voila quelques explications :


    1) On crée un script qui vérifie l'état d'un programme, dans l'exemple c'est le daemon mysql, moi j'ai remplacé ça par proftpd.
    Evidemment j'ai contrôlé l'emplacement du programme et sa syntaxe sinon ça ne marche pas.


    2) On utilise cron pour lancer périodiquement ce script en modifiant l'emplacement et le nom du script bien évidemment.


    On a donc cron qui démarre le script toutes les 5 mn, ce script vérifie que dans les processus proftpd tourne, si c'est le cas il ne fait rien sinon il le démarre.


    J'ai testé et ça fait le job c'est formidable.

  • If you need to monitor services, do it with existing frameworks (e. g. Icinga)

    IMO a bit overkill especially when it's about only one single host where you want to monitor services. Also overkill but pretty straightforward: webmin. You can configure email notifications for service status and also trigger commands when a certain condition is met (e.g. service not running any more).


    But I agree that diagnosing and fixing the problem is the smarter approach (logs exist for a reason).


    And OMV users need to be careful to never manage OMV's services (e.g. Samba) via Webmin.

  • Right, icinga is overkill in this case, I agree. But those cron jobs that autorestart services are stuff from my nightmares as they just dont fit into the concepts that exist and make multi admin systems a pain.

  • Right, icinga is overkill in this case, I agree. But those cron jobs that autorestart services are stuff from my nightmares as they just dont fit into the concepts that exist and make multi admin systems a pain.

    My cron job doesn't autoresart the service....
    My cronjob start a script who check the healthy of the service, and the srcipt restart the service if it's needed.
    Ok I could use Scheduled Jobs of OMV in place of cron job, but it's just for a private home server, I am the only admin so where is the pain ?

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!