Add Today's Date to Cronjob URL - cron

I'm trying to add today's date to my cronjob that's running. Though the date isn't currently appending. Am I doing something wrong here?
0 8 * * * /usr/bin/wget -O - -q -t 1 "https://www.exampleurl.com?date=`date +\%y\%m\%d`"

Related

Crontab error: "/tmp/crontab.calJpk":5: bad day-of-month

I am trying to run a crontab with the expression given below. But i am getting bad day-of-month error.
My requirement is to run this code:
everyday except Sunday
every hour starting 2 am till 10pm
0 2-22 ? * 0-6 * /usr/bin/python /my/location/to/python_code_for_cron/sampletest.py
Is there some issue with the cron expression or something else that i need to install?
FYI: I am using crontab -e to edit my crontab
You just have too many arguments in there. Read man -s5 crontab for more info. The fields are:
minute hour day-of-month month day-of-week
Also, 0-6 is the same as * for day-of-week. Your line should read:
0 2-22 * * 1-6 /usr/bin/python /my/location/to/python_code_for_cron/sampletest.py

Cron Jobs Run At Same Time

In my cron job file I have two cronjobs defined:
#Yo1 MAILTO="example#domain.com"
*1****wget -O - -q "http://example.com/cron/test1.php">/dev/null 2>&1
#Yo1 MAILTO="example#domain.com"
*15****wget -O - -q "http://example.com/cron/test2.php">/dev/null 2>&1
The PHP files are simple just sending mails with different subjects.
The issue is that both cronjobs are running on the same time every minute, but as you can see I want them to run on different times. First - every minute, second - every 15 minutes.
Can you help me with this. I can't figure out whats wrong.
Your syntax is incorrect.
Please use the following code
#every minute
* * * * * wget -O - -q "http://example.com/cron/test1.php">/dev/null 2>&1
#every 15 minutes
*/15 * * * * wget -O - -q "http://example.com/cron/test2.php">/dev/null 2>&1
You can use online crontab generators like http://www.crontab-generator.org/
* * * * * wget -O - -q "http://example.com/cron/test1.php">/dev/null 2>&1
15 * * * * wget -O - -q "http://example.com/cron/test2.php">/dev/null 2>&1

Ping website url from cronjob apache

I need to setup simple cronejob to ping my website url every 2 minutes, what i did for now make no effect, can somebody help me write simple ping cronjob?
Here is what i have for now
2 * * * * /usr/bin/wget -O - -q -t 1 http://example.com/api/get.php?refresh=yes
This might help:
*/2 * * * * wget -q -O - "http://example.com/api/get.php?refresh=yes" >/dev/null 2>&1
Every 2 minutes (15 in the article), ping the specified file without
any output whatsoever. Just a silent ping to execute my script,
nothing more, nothing less.
Source: https://wp-mix.com/cron-notes-ping-external-url-with-no-output/

Scheduling shell script in crontab

I have a shell script that I can run with root user this way:
root#vivid-15:~# ./backup.sh
It's on /root/backup.sh. Now, how do I schedule it on crontab to execute every day at 01:00 AM? I done this:
0 1 * * * root
But now I don't know how to proceed the command to do that.
Have you tried this? Also, a "1" in the hour field means 1am, not 1pm.
0 1 * * * root /root/backup.sh
Edit: changed the 13 (1pm) back to 1 (1am).
Crontab format:
MIN HOUR DAY MON WEEKDAY CMD
I don't know that you need to define what user you want it to run as when its in crontab -- commands will be run as the user who makes the entries with crontab -e. To create a cron process that runs as root, either login as root or set it up with $ sudo crontab -e
I think you're looking for something more like this:
0 1 * * * /root/backup.sh

how create cron command

how can i call some url like stackoverflow.com from cron without getting return data from page?
The format for cron is as follows:
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
For example, a cron to run at 9am every day and connect to a site would look like this:
0 9 * * * wget --spider http://www.stackoverflow.com > /dev/null 2>&1
Run crontab -e to edit the crontab, add this line to it and save.
use this:
wget --spider http://www.stackoverflow.com > /dev/null 2>&1
This command calls the url but doesnt download the output and redirect stderr and stdout to /dev/null

Resources