I've tried several different implementations as follows:
05 11 * * * cd /home/pi/kippo/; ./start.sh
05 11 * * * /home/pi/kippo/start.sh
05 11 * * * bash /home/pi/kippo/start.sh
05 11 * * * sh /home/pi/kippo/; ./start.sh
I've tried this crontab entry and in order to test if my timezone is correct. I've also tried creating text files to ensure that my crontab is functioning well.
05 11 * * * touch /home/pi/bin/hellotestkippo.txt
I've created this text file to ensure and test if at the same time I'm trying to run Kippo can be created to serve as a checker that cron does it's job.
The problem is the text file was created but kippo didn't start at all.
Please help me on this matter. Thanks.
try this commond:
sh /home/pi/kippo/start.sh
Edit your /etc/rc.local and add:
su - pi -c kippo/start.sh
Related
I am looking to schedule a cron from 10PM to 1AM(both inclusive) every half an hour .
I tried this */30 22-0 * * *
doesn't seem to work after 11:30 PM
or to be specific this works till 11:59 PM I guess.
Cron doesn't always provide the syntax to specify the times you want in a single line, but there's usually a workaround using two lines (or sometimes more).
Based on your description, apparently a range whose upper bound is smaller than its lower bound doesn't wrap around; rather it just seems to extend to the end of the day/hour/whatever. In your case, 22-0 apparently represents hours 22 and 23, and presumably 22-5, for example, would mean the same thing. (The man page is unclear on this.)
This should do the trick, though I haven't had a chance to test it:
*/30 22-23 * * * <command> # 22:00, 22:30, 23:00, 23:30
*/30 0 * * * <command> # 00:00, 00:30
0 1 * * * <command> # 01:00
Based on the other answer: You can make the crons one line less by combine records for 22-23 and 0 hour:
*/30 0,22-23 * * * <command>
0 1 * * * <command>
In some UNIX operating systems this may not work and you should explicitly mention the hours and minutes:
0,30 0,22,23 * * * <command>
0 1 * * * <command>
I'm tring to run a function every 10 minutes.
According to the documentation, it is stated that e.g ("0 0/5 * * *?") Runs every 5 minutes since the program started, but why when I change 5 by 10 ("0 0/10 * * *?"), the function does not run every 10 minutes e.g (10:10 - 10:20 - 10:30)
Is it really me who misunderstands the Cron Expressions or the syntax is wrong.
here is typo in :
"0 0/10 * * *?"
should be
"0 0/10 * * * ?"
here is the useful resource CronMaker is a utility which helps you to build cron expressions. CronMaker uses Quartz open source scheduler.
I have a list of crontab entries:
0 * * * * /home/tomcat/abc.sh
0 * * * * /home/tomcat/def.sh
I want to perform an action through a bash script and it requires one of the cron jobs to be disabled.
#0 * * * * /home/tomcat/abc.sh
0 * * * * /home/tomcat/def.sh
How can I comment a single cron job using bash script?
Please help. Thanks!
That's kinda dangerous in my book, I wouldn't recommend doing that. Instead, I'd update your script so that it creates a file (like /tmp/MY_SCRIPT_LOCK or whatever) at the start and removes the file at the end. Then just update the cron job so it doesn't run if it finds the file:
0 * * * * test -f /tmp/MY_SCRIPT_LOCK || /home/tomcat/abc.sh
If you want to add a comment (#) at a particular line you can use -
Third line:
sed '3s/^/#/' filename
You can save this as new file or use output redirections.
I would like to open a URL using crontab in the terminal every minute for example. I also tried "cronnix" and "lingos" but non of the methods work. My mashine simply does not execute the command. I did
crontab -e
then I inserted the line
1 * * * * open http://www.google.de/
terminal says it is installing the new cron job. But then nothing happens. What do I have to do? Thanks.
1 * * * *
means the job will execute every first minute of every hour of every day of every week of every month, for example at 09:01, 10:01, 11:01, ...
*/x * * * *
will execute the job every x'th minute of every hour of every (yadda yadda...).
For example, for x=5 the job will execute at 09:05, 09:10, 09:15, and so on, but also of course at 10:05, 10:10, 10:15, ...
For x=1 it is the same as just saying
* * * * *
I want to set a cronjob entry that runs a script every 30 minutes from 9:00 to 18:00 but I do not want it to run at 18:30. The script should run for the first time at 9:00 and for the last time at 18:00. Is this possible?
Yes, it is possible; cron itself can't solve the task, but it is possible using additional shell command:
*/30 9-18 * * * root [ $(date +%H%M) = 1830 ] || your_command
your_command will be executed if and only if the current time is not equal to 18:30
You might need to have two entries:
0,30 9-17 * * * /script
0 18 * * * /script
Alternatively, you could modify your script to check if it's close to 18:30 or not, and exit early if so.