zoukankan      html  css  js  c++  java
  • Check to see if python script is running Stack Overflow

    Check to see if python script is running - Stack Overflow

    Check to see if python script is running up vote 8 down vote favorite 7 share [g+] share [fb] share [tw] I have a python daemon running as a part of my web app/ How can I quickly check (using python) if my daemon is running and, if not, launch it? I want to do it that way to fix any crashes of the daemon, and so the script does not have to be run manually, it will automatically run as soon as it is called and then stay running. How can i check (using python) if my script is running?

    Monitor and restart Apache or lighttpd webserver when daemon is killed

    Monitor and restart Apache or lighttpd webserver when daemon is killed by VIVEK GITE on NOVEMBER 21, 2006 · 46 COMMENTS When you cannot monitor your server for service availability, it is better to take help of automated monitor and restart utility. Last 4 days I was away from my server as I was enjoying my vacation. During this time due to load my lighttpd webserver died but it was restarted automatically within 2 minutes. I had utility configured for monitoring services on a Linux system called monit. It offers all features you ever needed for system monitoring and perform error recovery for UNIX like system. Before monit I had my own shell and perl script for monitoring service. If service failed script will try to restart service and send an automated email to me. However monit is a superior solution. monit is a utility for managing and monitoring processes, files, directories and devices on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. For example, monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses to much resources. You may use monit to monitor files, directories and devices for changes, such as timestamps changes, checksum changes or size changes. You may also use monit to monitor files, directories and devices on localhost. Monit can monitor these items for changes, such as timestamps changes, checksum changes or size changes. This is also useful for security reasons you can monitor the md5 checksum of files that should not change. Personally, I always install and configure monit on all boxes which are under my control. Install monit under Debian or Ubuntu Linux Use apt-get command to install monit # apt-get install monit OR $ sudo apt-get install monit Install monit under Red Hat enterprise Linux / CentOS Linux (source code installation) Many distributions include monit. However monit is not included in official Red hat enterprise Linux. Just download monit source code from official web site using wget command: # cd /opt # wget http://www.tildeslash.com/monit/dist/monit-4.8.2.tar.gz Untar monit # tar -zxvf monit-4.8.2.tar.gz # cd monit-4.8.2 Configure and compile monit: # ./configure # make Install monit # make install Copy monit configuration file: # cp monitrc /etc/monitrc By default monit is located at /usr/local/bin/monit How do I Configure monit? monitrc is name of monit configuration file and it is by default located at /etc/monitrc location. However each distribution places file in different location: . => Source code installation : /etc/monitrc => Debian / Unentu Linux installation : /etc/monit/monitrc Open monit configuration file and setup values as follows: # vi /etc/monitrc a) Run it as daemon and check the services (such as web, mysql, sshd) at 2-minute intervals. set daemon 120 b) Set syslog logging with the 'daemon' facility:
  • 相关阅读:
    软件包管理器(bzoj 4196)
    Aragorn's Story(hdu3966)
    染色(bzoj 2243)
    文艺平衡树(bzoj 3223)
    区间翻转(codevs 3243)
    Python 中 configparser 配置文件的读写及封装,配置文件存放数据,方便修改
    Python 中 openpyxl 模块封装,读写 Excel 文件中自动化测试用例数据
    Python 中 unittest 框架加载测试用例的常用方法
    Python 中 unittest 单元测试框架中概念、作用、运行、用例执行顺序、断言方法、装饰器
    接口自动化的应用场景、测试用例、自动化流程
  • 原文地址:https://www.cnblogs.com/lexus/p/2502748.html
Copyright © 2011-2022 走看看