Wget Cronjob, Godaddy.


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Wget Cronjob, Godaddy.
# 1  
Old 08-18-2016
Question Wget Cronjob, Godaddy.

Hello,

I'm trying to automate a wget cronjob for Php 5.4 on Wordpress - using Cpannel on a linux server hosted by Godaddy. Below is the command I'm using, which isn't working.

Code:
wget -q -O "[MYHTTPWEBSITE]/wp-cron.php?import_key=[MYIMPORTKEY]&import_id=[MYID]&action=trigger" >/dev/null 2>&1

========== EDIT

Thank you so much for everyone that pitched in, this was the command that eventually worked.

wget -O - "http://mywebsite/wp-cron.php?import_key=[MYIMPORTKEY]&import_id=[MYID]&action=trigger"

In my case, putting a simple - dash after the -O fixed the problem.
In my case, I simply wanted to call the link to process a script in wp-cron.php.
If someone could clue me/others in as to why the - made the difference I'd appreciate it.

Last edited by embus; 08-30-2016 at 07:40 AM.. Reason: Solved
# 2  
Old 08-18-2016
Leave out wget's -q, which stands for "quiet". Also remove the 2>&1 to see which errors/messages are being written to STDERR.

If you want to see all things that are written to STDOUT too, leave out >/dev/null 2>&1 too. This might help to see at which position the errors occure.
This User Gave Thanks to zaxxon For This Post:
# 3  
Old 08-18-2016
Thanks for that, I see a little more clearly how the q works now. This is the response I get, suggesting it can't read the URL. I can't post urls here yet, but i've put it in as lynora.co.uk, (with a http above).

Code:
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try ‘wget --help’ for more options.


Last edited by embus; 08-18-2016 at 11:42 AM..
# 4  
Old 08-18-2016
Quote:
Originally Posted by embus
Thanks for that, I see a little more clearly how the q works now. This is the response I get, suggesting it can't read the URL. I can't post urls here yet, but i've put it in as lynora.co.uk, (with a http above).
You have to modify your call a little, like this:

Code:
wget <options_go_here> --post-data="?import_key=<your call here>...." "your.url.here"

Notice that you may need to save cokkies in a file if you need to operate persistent connections (like in logging into a website, doing something, then logging off). See the --save-cookies=<file>, --load-cookies=<file> and the --keep-session-cookies parameters of wget.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 5  
Old 08-18-2016
Thank you Bakunin, I see you're splitting the code and removing the ampersands. With a post ID check as well would it look something like this?

Code:
wget -O --post-data="?import_key=[mykey]" "import_id=[MYID]" "my.website.url.here"

# 6  
Old 08-18-2016
Quote:
Originally Posted by embus
I see you're splitting the code and removing the ampersands.
No, no, you need the ampersands. after the "--post-data" you put everything you have in your URL string, you just keep the URL itself as the last parameter.

Here is an example: When i reply to this thread my browser shows a URL like this:

Code:
https://www.unix.com/newreply.php?do=newreply&p=302979733

If i would have to use this in a wget-statement it would look like this:

Code:
wget -O -<other options> --post-data="?do=newreply&p=302979733" "https://www.unix.com/newreply.php"

Again, you might need to provide persistent identification information via "--keep-cookies", etc., as i said above.

I hope that clears it up.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. https://www.sam.gov/SAMPortal/extractfiledownload?role=WW&version=SAM&filename=SAM_PUBLIC_MONTHLY_20160207.ZIP I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

2. Shell Programming and Scripting

How to download Images and Json file from server(godaddy) to Local machine (Ubuntu 14.04).?

Hi Guys, Just entering the Linux word, So I need help to write a script on my local machine(Ubuntu 14.04) that continuously check the particular folder(contains images) and a json file on the server and download whenever new images are added to that folder and whenever there is a change in the... (10 Replies)
Discussion started by: g4v1n
10 Replies

3. Shell Programming and Scripting

Running a KSH file from VPS on Godaddy

i have looked for a week and tried a few things, but nothing seems to work so joined here. I have a go daddy account and also a vps in germany. In my vps, i run a code script (we will call it codegen) when i run ./codegen i get my question of how many codes do i want to make. With my answer... (9 Replies)
Discussion started by: uksatman
9 Replies

4. UNIX for Dummies Questions & Answers

Postfix Dovecot Roundcube Godaddy

Long story short, I have everything working in my SOHO which would include Postfix,Dovecot(imap),Roundcube,bind and is ready to recieve email from the outside using this tutorial: https://workaround.org/ispmail/wheezy I also setup my internal DNS server using: https://wiki.debian.org/Bind9... (2 Replies)
Discussion started by: metallica1973
2 Replies

5. UNIX for Dummies Questions & Answers

Cronjob help

Hi I am very new to linux. I want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files I want it to send an email to me. All I have is this... */15 * * * * ls -l | wc -l | | mail -s "This is just a test" I would... (2 Replies)
Discussion started by: LinuxNewb
2 Replies

6. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

7. Solaris

at vs cronjob

HI, What is the differnece between at / con job? thanks in advance. (1 Reply)
Discussion started by: mokkan
1 Replies

8. HP-UX

CronJob

Dear Guru, I have submitted some cronjobs that has been running for quite sometimes. However, today I counter some cronjob did not run. Can you please explain what causes this to happen. Any system setting that limit number of cronjob per minutes to be started, etc? Thanks. Kelly (1 Reply)
Discussion started by: hcng08
1 Replies
Login or Register to Ask a Question