>~/log works well and adds a line to the log file with There are rows with total_time. But the same line as cron does nothing. It's not a path issue as curlmyurl.com>>~/log works."> Percent sign % doesn't work in crontab-PHP Chinese Network Q&A
Percent sign % doesn't work in crontab
P粉818088880
P粉818088880 2023-08-24 23:01:55
0
1
433

I'm having a cron problem with curl:

curl -w "%{time_total}\n" -o /dev/null -s http://myurl.com >> ~/log< ;/pre> 

Works great and adds a line with total_time in the log file.

But the same line as cron does nothing.

This is not a path issue, since curl http://myurl.com >> ~/log works.

P粉818088880
P粉818088880

reply all (1)
P粉340264283

%is a special character forcrontab. Fromman 5 crontab:

So you need to escape the%characters:

curl -w "%{time_total}\n" -o /dev/null -s http://myurl.com >> ~/log

to

curl -w "\%{time_total}\n" -o /dev/null -s http://myurl.com >> ~/log ^
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!