CRON TAB working fine for */15 but not working for 12/15 - cron

My cron job is working fine if I write
*/15 16 * * * setup.sh
It is called cron job at every 15th minute like 0,15,30,45 and again 0.
I need to run 15th minute of a specific time
Ex: crontab(12)
12/15 16 * * *
This is correct by https://crontab.guru/ but showing a non-standard cron job may not work on some crontab.
And also not working in my case.
Help me to sort it out. Thanks in advance

The "12/" part is what makes it non-standard.
You could rewrite it as:
12,27,42,57 16 * * *
And that should work.

Related

Crontab every 3 days not working

The last week I created a new crontab to do backups each three days and it didn't work.
This is the cron:
0 12 */3 * * /home/importante.sh
It's supposed to execute every three days at 12:00, but it didn't work for me.
Tried the script and is working fine, just the cron not executing it, any idea?
Your cron entry looks fine. You are just missing the bash command.
0 12 */3 * * /bin/bash /home/importante.sh
I am assuming you are using bash. Just replace if it's different for you.

Cron periodically for different scripts

I would like to run several scripts every half-hour. This obviously would work with this line
*/30 * * * * script.sh
My question now is how I would be able to run several of these at different times. As in, script.sh to run 5 minutes before script2.sh which then is 5 minutes before script3.sh. If that shouldn't be possible, any way to ensure that they aren't executed within 5 minutes of each other would suffice.
I did see solutions to do this with a script or otherwise programmatic. If cron can't be used for the job a "not possible" is what I'm looking for as the answer.
*/30 is equivalent to 0,30. If you use the latter syntax you can simply use 5,35 for another job to offset it from the first.
For example, for three jobs you could do:
0,30 * * * * script1.sh
5,35 * * * * script2.sh
10,40 * * * * script3.sh
Note that if script1.sh takes longer than 5 minutes to run, there will still be overlap between script1.sh and script2.sh. If you really must avoid that, you should probably consider lock files (using e.g. flock).

Linux .SH Programs

I just like to ask if anyone here knows how to automatically start a .sh program in Linux on a daily basis.
This is because I have a server running which runs untill a certain point at midnight then stops. I'd like to have a program that can automatically restart it at a certain time every day.
you can automatically run the script by using the cron deamon
First you have to add the command to cron
crontab -e //this will open a file with your default editor
//to this file add your command at last
command syntax:
* * * * * * /home/loc/shell.sh //runs every minuite
ex */45**** /home/loc/shllscript.sh // runs every 45 mins
cron will do what you need to do.
The first line will start your script at 2:30 every day. The second line will stop it at 12:00
30 2 * * * myscript.sh
00 12 * * * killall myscript.sh
you can also refer to "at", which can run jobs at certain time period

What's the difference between these two crontab settings?

I'm looking at a crontab on a linux server and came accross the following line
*/1 * * * * /path/to/file
To me this means run the cron every 1 minute right?
What makes it different from this?
* * * * * /path/to/file
I'm fairly new to Linux crontab so hopefully this isn't a dumb question.
'*/1' is a step definition and means every minute; it is identical to the second format.
If you would want to do something every 2 hours, you could do this:
* */2 * * * /path/to/file
See: (search for the word "Ranges")
man 5 crontab
There's no difference. The cron scheduler sees them both as 1 minute from the last run.

Cron command to run PHP script every 10 minute

In my hosting i have a section for cron job like this:
(source: site-helper.com)
The PHP script is called "croned.php", which I want it to run every 10 minutes.
What I will fill in every field?
I tried but it didn't work.
Note: the full path to the script is: /home/axelzd/domains/hellodom.com/public_html/croned.php
Put */10 in the minutes whilst putting * in all other fields.
Usually you can use commas to separate the cron minutes/hours etc. - 0,10,20,30,40,50 in your minute field (but I can't guarantee your admin will take it - I know Plesk does) and * in all others . The command is more tricky, but something like this should do /usr/bin/wget -q -t 5 --delete-after URL_TO_YOUR_CRON or php PATH_TO_YOUR_PHP_FILE_ON_THE_SERVER
try this
*/10 * * * * <command_to_be_invoked>

Resources