Reputation: 1645
In linux:with crontab: I test with as :
* * * * * /bin/echo "xin chao">> /home/iloveyou/text.txt
. It work fine.
But when i test run an url:
*/3 * * * * /usr/bin/curl -k https://192.169.30.126/joomlandk2/index.php/exportmanager
It's don't working. when i run as: /usr/bin/curl -k https://192.169.30.126/joomlandk2/index.php/exportmanager
from Terminal window. It run ok.
Why? I want set run https://192.169.30.126/joomlandk2/index.php/exportmanager
with crontab. Can you help me? Thanks.
Upvotes: 2
Views: 299
Reputation: 14853
At OP request this answer details how to step-by-step, duplicate user environment in crond context.
In crontab, put a call to a shell script.
*/3 * * * * /home/userX/dir/exportmanager.sh
In the shell, echo or/and set environment before calling curl to have similar conditions of your own environment.
Https use SSL keys, how curl looks for this keys, in which certificate repository?
See --capath
option.
#!/bin/bash
set VAR=value
/usr/bin/curl -k https://192.169.30.126/joomlandk2/index.php/exportmanager\
>/home/userX/dir/exportmanager.log
Upvotes: 1
Reputation: 11561
It might be some special characters issue. Put the command into a wrapper script, add run permission rights and switch crontab to point to it.
Upvotes: 1