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:
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· DeepSeek 解答了困扰我五年的技术问题。时代确实变了!
· 本地部署DeepSeek后,没有好看的交互界面怎么行!
· 趁着过年的时候手搓了一个低代码框架
· 推荐一个DeepSeek 大模型的免费 API 项目!兼容OpenAI接口!
2010-05-16 小朋友,知道威客吗?
2010-05-16 这个图是怎么生成的呢?
2007-05-16 关于div的定位显示问题