LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-11-2019, 11:46 AM   #1
agentguerry
LQ Newbie
 
Registered: Aug 2015
Posts: 11

Rep: Reputation: Disabled
Question curl command with soap xml writing to log file


I have a script that runs a curl command with a soap xml file.
If i run it manually the output is saved to a log file.

If i put it in cron, the output does not write to a file.

curl --insecure --header "Content-Type:text/xml;charset=UTF-8" --header "SOAPAction: findPeopleByCriteria" --data @soap.xml https://mysite.edu/staff/people.wsdl --cert pemfile.pem >> curlout.log

If i run it manually, i get the output to the file.
But when i set it up via cron to run automatically, no output to the file.

Anyone ever seen this before? I've tried the -o option with curl, different redirect variables (2>&1, etc.) nothing seems to work when its in cron.

Thanks!
 
Old 12-11-2019, 12:14 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Cron is not aware of the environment, including path, which is defined when you run it manually so you will have to give it the absolute path to any files it must access at runtime.

Last edited by astrogeek; 12-11-2019 at 12:16 PM.
 
2 members found this post helpful.
Old 12-13-2019, 09:41 AM   #3
agentguerry
LQ Newbie
 
Registered: Aug 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
yeah that's what i was reading up on and thought.
I tried the full path, and also putting a variable in for curl as `which curl`

Still a no go.

I tried different output redirects, and still nothing pushes the curl output.
but it can of course push the output of curl www.google.com to a file.

maybe its just something weird about using a soap call and redirecting it.
 
Old 12-13-2019, 10:04 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,295
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
The question is still probably one of paths, probably for all options which point to files:

Code:
curl --insecure \
     --header "Content-Type:text/xml;charset=UTF-8" \
     --header "SOAPAction: findPeopleByCriteria" \
     --data @/path01/soap.xml \
     --cert /path02/pemfile.pem \
     https://mysite.edu/staff/people.wsdl \
     >> /path03/curlout.log

Last edited by Turbocapitalist; 12-13-2019 at 01:05 PM. Reason: typo
 
Old 12-13-2019, 01:03 PM   #5
agentguerry
LQ Newbie
 
Registered: Aug 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
yeah i checked all my paths, set them to the full pwd of the file needed.
still a no go.

/sad
 
Old 12-13-2019, 01:11 PM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,295
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
What does that part of your cron job look like?

Code:
crontab -l
What happens when you try to trap errors to a file?

Code:
curl ... --stderr /tmp/error.log
That might show what curl is complaining about.

You might also look at combining the --silent and --show-error options.
 
  


Reply

Tags
cron, curl, output, soap



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 03:45 PM
libvirt: post virt-clone, unchanged values in resulting XML file from original XML file CptSupermrkt Linux - Virtualization and Cloud 1 04-14-2016 08:20 AM
php / SOAP - is it possible to return many values in a soap request? eantoranz Programming 1 04-25-2012 03:21 PM
php5 xml soap mystery on a Suse 11 enterprise server Boucane Programming 4 06-19-2009 01:11 AM
Resource Recommendation - LAMP, Oracle Bekeley DB, HTML/XHTML/XML/SOAP, CSS, Java,etc techieg Linux - Newbie 2 04-15-2009 06:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration