2018年10月11日 星期四
2018年10月6日 星期六
2018年6月4日 星期一
2018年6月3日 星期日
CURL
curl -C - -L -v -O --retry 999 -S
"http://www.archive.org/download/usgs_drg_nc_35077_b1/o35077b1.tif"
CURL *curl; CURLcode res; struct curl_slist *headers=NULL; // init to NULL is important headers = curl_slist_append(headers, "Accept: application/json"); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://web.com/api/json/123");//cant get json file curl_easy_setopt(curl, CURLOPT_URL, "http://web.com/pages/123.html");//this returns entire webpage curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_RETURNTRANSFER, true); res = curl_easy_perform(curl); if(CURLE_OK == res) { char *ct; // ask for the content-type res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); if((CURLE_OK == res) && ct) printf("We received Content-Type: %s\n", ct); } } // always cleanup curl_easy_cleanup(curl);
"http://www.archive.org/download/usgs_drg_nc_35077_b1/o35077b1.tif"
CURL *curl; CURLcode res; struct curl_slist *headers=NULL; // init to NULL is important headers = curl_slist_append(headers, "Accept: application/json"); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://web.com/api/json/123");//cant get json file curl_easy_setopt(curl, CURLOPT_URL, "http://web.com/pages/123.html");//this returns entire webpage curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_RETURNTRANSFER, true); res = curl_easy_perform(curl); if(CURLE_OK == res) { char *ct; // ask for the content-type res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); if((CURLE_OK == res) && ct) printf("We received Content-Type: %s\n", ct); } } // always cleanup curl_easy_cleanup(curl);
PID
https://www.cyberciti.biz/faq/linux-pidof-command-examples-find-pid-of-program/
#!/bin/bash # please ignore our pid and get all pids of lighttpd on server list=$(pidof -o %PPID lighttpd) # .. now do something on all pids stored in $list for p in $list do echo "Killing $p..." kill -TERM $p done |
訂閱:
文章 (Atom)