cron

why my svn backup shell script, works fine in terminal, but fails in crontab?

若如初见. 提交于 2020-01-06 04:25:08
问题 I have a svn backup script in a redhat linux. let's it called svnbackup.sh It works fine, when I run it in terminal. But when I put it into crontab, it will not bring the svnserve back, even the data is backuped correctly. What's wrong with me??? killall svnserve tar -zcf /svndir /backup/ svnserve -d -r /svndir 回答1: Usually, 'environment' is the problem in a cron job that works when run 'at the terminal' but not when it is run by cron. Most probably, your PATH is not set to include the

How can cron output to a new log file based on date?

风流意气都作罢 提交于 2020-01-06 01:55:08
问题 I'd like to log cron output to a dated file — /tmp/log/cron-2014-12-17.log $ mkdir /tmp/log $ chmod 777 /tmp/log $ ls -lah /tmp/log drwxrwxrwx 2 root root 4.0K Dec 17 21:51 . Cron (via root user) * * * * * /usr/bin/php /path/to/script.php > /tmp/log/cron-$(date "+%F").log 2>&1 /tmp/log remains empty after each minute. If I run the script manually from command line a log file is created, and output is as expected. // Running it manually as a CLI works fine, but not as a cron $ /usr/bin/php

Bash program in cron that runs everytime the program is terminated

梦想与她 提交于 2020-01-05 10:37:08
问题 I want to set a cron job in ubuntu with this job I have a python webscraping program which needs to be scrapped continuously after the program is terminated. In other words the flow is like this If program is terminated, set the cron job again (until infinity in cron's method) something like * * * * * /python.py (but only when the python.py is terminated/finished) Can someone guide me to write a bash program that does this job? The program is python.py thanks 回答1: when the program runs, write

How to invoke cron job from php script?

僤鯓⒐⒋嵵緔 提交于 2020-01-05 10:25:13
问题 I wanted to set cron job from php script file. I can able to execute php file using shell_exec() function. But Im not able to run cron job related commands. $output = shell_exec("crontab -l"); this command is not working. My cronjob located under /usr/bin/crontab. I set the file premission to 777 and im executing this command with root access. still no luck. can anyone help me? 回答1: Your "crontal -l" command just displays what's scheduled for your user in its personal crontab. It might return

Cron job Issue in raspberry-pi

半腔热情 提交于 2020-01-05 08:26:27
问题 from time import sleep import datetime import os import shutil import cv2 from filename import opvideo ## Adding New Directory path= '/home/pi/Desktop/teasr/input-video'+opvideo os.makedirs(path) path1= '/home/pi/Desktop/teasr/input-image'+opvideo os.makedirs(path1) os.makedirs('/home/pi/Desktop/teasr/output-video'+opvideo) #######capturing cap = cv2.VideoCapture(0) # Define the codec and create VideoWriter object fourcc = cv2.cv.CV_FOURCC(*'XVID') out = cv2.VideoWriter('/home/pi/Desktop

rails script using whenever gem error: __rvm_add_to_path: command not found

一曲冷凌霜 提交于 2020-01-05 07:59:21
问题 I'm using capistrano and the whenever gem. Capistrano deploys and updates the crontab on our ubuntu server with the cronjob detailed out in our schedule.rb file. But the cronjob doesn't happen. It fails and emails me every 5 minutes this error: /etc/profile.d/rvm.sh: line 67: __rvm_add_to_path: command not found /home/pkatepalli/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError) from /home/pkatepalli/.rbenv

restart service crontab problem

落花浮王杯 提交于 2020-01-05 07:23:30
问题 if i run the script below manually from putty (as root) then the service is restarted no problem manual command sh /home/auser/server/reService.sh >> /var/log/reService.log But if the same script is scheduled as a cronjob, also under root: crontab command 00 07 * * * /home/auser/server/reService.sh 2>&1 >> /var/log/reService.log then the 'service myService restart' is not executed successfully: service is not restarted, and no command output in scheduled log compared to manual log. I can also

How to notify the admin if the items(Multiple items) are going to expire in days later-Laravel

为君一笑 提交于 2020-01-05 04:07:11
问题 There are many items in the Items table and there is an expired date column in the items table. I just want to get a push notification every day before each items going expire one date before (Expire dates are different to each other and can have one expire date to multuple items). im new to laravel. Please help me. 回答1: This can be simply done with Laravel task scheduling You need to create a custom artisan command like php artisan make:command SendItemExpiryEmailsToAdmin Under App\Console

How to fire the job on first monday of month using cron expresssion in spring @Scheduled?

╄→尐↘猪︶ㄣ 提交于 2020-01-05 03:32:07
问题 Now I have the following declaration: @Scheduled(cron = "0 0 12 ? * MON#1") protected synchronized void execute() {...} and it doesn't work: at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.9.RELEASE.jar:1.5.9.RELEASE] Caused by: java.lang.IllegalStateException: Encountered invalid @Scheduled method 'execute': For input string: "2#1" at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor

How to fire the job on first monday of month using cron expresssion in spring @Scheduled?

回眸只為那壹抹淺笑 提交于 2020-01-05 03:32:03
问题 Now I have the following declaration: @Scheduled(cron = "0 0 12 ? * MON#1") protected synchronized void execute() {...} and it doesn't work: at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.9.RELEASE.jar:1.5.9.RELEASE] Caused by: java.lang.IllegalStateException: Encountered invalid @Scheduled method 'execute': For input string: "2#1" at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor