cron

cron killed by system

Deadly 提交于 2021-02-11 14:44:13
问题 My cron service keep killed by OS around 2-3 day after start which really frustrating, but seems no one encounter with this situation(nothing learn from google). Can you advice how to trace this issue? This behavior is random, no explicit date and time. This time killed on 00:00:01. resources is enough. 09:55:01 PM CPU %user %nice %system %iowait %steal %idle 10:05:01 PM all 2.45 0.00 4.04 0.06 0.00 93.45 10:15:01 PM all 1.27 0.00 3.98 0.00 0.00 94.74 10:25:01 PM all 1.46 0.00 3.96 0.01 0.00

Python script using Cron Job Not saving output to file in Google VM Instance

这一生的挚爱 提交于 2021-02-11 14:34:04
问题 I am trying to run a python script in my Google VM Instance using Cron jobs. My script is supposed to log some data from a website and stores it in a CSV file. I tried running it using the usual python3 kb_sc.py and it worked just fine. ... #scrap the website print("checkpoint") if not (os.path.isdir(path)): os.makedirs(path) if not (os.path.isfile(path + file)): data_new.to_csv(path+file, index = False) else: data = pd.read_csv(path+file) data = data.append(data_new) data.to_csv(path+file,

Problem on looking for running tomcat process id

被刻印的时光 ゝ 提交于 2021-02-11 13:10:27
问题 Sometimes my tomcat server auto shutdown due to some memory issue, so I want to use the below script to check whether tomcat is running: checkTomcatRunning.sh TOMCAT_PID=$(ps -ef | awk '/[t]omcat/{print $2}') echo TOMCAT PROCESSID $TOMCAT_PID if [ -z "$TOMCAT_PID" ] then echo "TOMCAT NOT RUNNING" sudo /opt/tomcat/bin/startup.sh else echo "TOMCAT RUNNING" fi Below is the crontab which output log to /opt/tomcat/logs/checkTomcatRunning.log crontab -l */1 * * * * /opt/tomcat/webapps

Problem on looking for running tomcat process id

半世苍凉 提交于 2021-02-11 13:07:24
问题 Sometimes my tomcat server auto shutdown due to some memory issue, so I want to use the below script to check whether tomcat is running: checkTomcatRunning.sh TOMCAT_PID=$(ps -ef | awk '/[t]omcat/{print $2}') echo TOMCAT PROCESSID $TOMCAT_PID if [ -z "$TOMCAT_PID" ] then echo "TOMCAT NOT RUNNING" sudo /opt/tomcat/bin/startup.sh else echo "TOMCAT RUNNING" fi Below is the crontab which output log to /opt/tomcat/logs/checkTomcatRunning.log crontab -l */1 * * * * /opt/tomcat/webapps

How to use django_crontab with os.environ['SECRET_KEY']?

假如想象 提交于 2021-02-11 12:50:19
问题 I'm using a django_crontab library and it worked fine until I decided to export my SECRET_KEY to an environmental variable. Summing up what I have done in bash (while in my venv): export SECRET_KEY='some_secret_key_from_settings' In settings.py: SECRET_KEY = os.environ['SECRET_KEY'] In addition, I use venv, so I've also added this to settings: CRONTAB_PYTHON_EXECUTABLE = '/path_to_my_venv/venv/bin/python3' This is the error that I have: SECRET_KEY = os.environ['SECRET_KEY'] File "/Library

How to use django_crontab with os.environ['SECRET_KEY']?

為{幸葍}努か 提交于 2021-02-11 12:50:07
问题 I'm using a django_crontab library and it worked fine until I decided to export my SECRET_KEY to an environmental variable. Summing up what I have done in bash (while in my venv): export SECRET_KEY='some_secret_key_from_settings' In settings.py: SECRET_KEY = os.environ['SECRET_KEY'] In addition, I use venv, so I've also added this to settings: CRONTAB_PYTHON_EXECUTABLE = '/path_to_my_venv/venv/bin/python3' This is the error that I have: SECRET_KEY = os.environ['SECRET_KEY'] File "/Library

Kubernetes job to delete a single pod every minute

╄→尐↘猪︶ㄣ 提交于 2021-02-11 06:43:38
问题 I'd like to create a Job to kill the following pod every single minute or any time when is created. My testing pod is: apiVersion: v1 kind: Pod metadata: name: myapp-pod labels: app: myapp spec: containers: - name: myapp-container image: busybox command: ['sh', '-c', 'echo Hello && sleep 3600'] Is it possible to do that? 回答1: Yes, you can delete the pods with kubectl within the cluster. First, you need to create a set of RBAC(Role-based access control) object. Here is the sample. apiVersion:

Initialize WordPress environment in a script to be run by a cron job

℡╲_俬逩灬. 提交于 2021-02-10 20:36:27
问题 I have to run a custom PHP script which I want to run by a cron job. Within that script, I need wordpress functions to insert users into WordPress table. My script is on the root directory of the wordpress installation. My script is starting with: require( dirname( __FILE__ ) . '/wp-load.php' ); If I run the script directly in the browser then my functions and everything else works with no errors. But when the cron hits it apparently does not work. Nothing that is supposed to happen happens.

20165233 预备作业3 Linux安装及学习

泪湿孤枕 提交于 2021-02-10 17:47:08
Linux学习记录 别出心裁的Linux命令学习法 学习总结 (由于我的电脑是Mac,Linux安装省略) 操作系统的功能: 管家婆 和 服务生 博客中对于这两个词含义的解释为 管家婆:通过进程、虚拟内存和文件三个重要抽象管理计算机的CPU、内存、I/O设备。 服务生:为用户提供shell,为程序员提供系统调用。 命令行的好处 主要是可以批处理并自动化,还有些功能GUI无法完成 由于我的电脑操作系统为MacOS,所以我自己总结出了快捷键的使用: Alt+Ctrl+T :打开终端(由于Mac没有打开终端的快捷键,所以我自己设置为与Ubuntu统一的快捷键。 Mac如何设置打开终端的快捷键 ) Command+T :新建标签页 Command + { 或 Command + Shift + [ :切换标签页 Tab :命令、文件名等自动补全功能。 Ctrl+R :快速检索使用过的历史命令 Ctrl+C :中断终端中正在执行的任务。 Linux基础入门 实验1 Linux 系统简介 Linux是什么? Linux 就是一个<span style="color:red">操作系统</span>。Linux 主要是 系统调用 和 内核 那两层。当然直观地看,我们使用的操作系统还包含一些在其上运行的应用程序,比如文本编辑器、浏览器、电子邮件等。 Shell是什么? 命令行解释器。 实验2

How Execute PHP File Using a Cron Job

混江龙づ霸主 提交于 2021-02-10 14:29:40
问题 I am using a WordPress site hosted on a DigitalOcean WordPress Litespeed droplet. I am attempting to run a php file in my theme every five minutes using a Cron Job. I don't want to use the default WordPress cron job system. So far I have connected to the sever through ssh. Then entered the crontab using "crontab -e" then entered the following code then saved / exit */5 * * * * php /var/www/html/wp-content/themes/my_theme/cron.php And inside the cron.php I put a simple mailing function for