I'm trying to add documents to a specific core that I have created before with this command:
./solr create -c kba_oct_2011
Than I add the schema using curl utility:
curl http://localhost:8983/solr/kba_oct_2011/schema -X POST -H 'Content-type:application/json' --data-binary '{
"add-field" : {
"name":"title",
"type":"text_general",
"indexed":true,
"stored":true
},
"add-field" : {
"name":"description",
"type":"text_general",
"indexed":true,
"stored":true
},
"add-field" : {
"name":"date",
"type":"date",
"indexed":true,
"stored":true
}
}'
And in the end I'm trying to add documents using post command:
./post -c kba_oct_2011 /home/IPA/IPA_ws/Dataset_news_KBA/2011/10_October/*.xml
In the directory /home/IPA/IPA_ws/Dataset_news_KBA/2011/10_October/ there are 72.420 files and when I execute the command I have this error:
-bash: ./post: Argument list too long
Someone can I help me?
Thanks!
This occurs beacuse your expanded argument list expands command line input limit.
Use xargs to provide argument list to your post command.
Related
I am new on Icinga2, using 2.4.0 version and I am trying to execute some API calls but I have found a problem when I have tried to create a service manually.
This is the command that I execute to create a service called api_dummy_service_1 for api_dummy_host_1 host:
curl -u $ICINGA2_API_USER:$ICINGA2_API_PASSWORD \
-H 'Accept: application/json' -X PUT \
-k "https://$ICINGA2_HOST:$ICINGA2_API_PORT/v1/objects/services/api_dummy_host_1!api_dummy_service_1" \
-d '{ "templates": [ "generic-service" ], "attrs": { "display_name": "api_dummy_service_1", "check_command" : "dns", "vars.dns_lookup": "google-public-dns-a.google.com.", "vars.dns_expected_answer": "8.8.8.8", "host_name": "api_dummy_host_1" } }' | python -m json.tool
When I execute it, the following error message appears:
-bash: !api_dummy_service_1: event not found
I have examinated Icinga logs, I have activated debug mode on Icinga also and tried to search information related to this in internet with no results.
Can anyone help me please? Thanks in advance!
Issue fixed! After doing more test in detail we have detected that the problem was related to the URL that we use to connect with icinga2 API, the ! character must be escaped.
I have changed ! to %21 and the command works
i'm trying to creating a new certificate database with CertUtil. like with this command:
C:\Users\mahdi>certutil -N -d .\
but i get error :
C:\Users\mahdi>certutil -N -d .\
CertUtil: Unknown arg: -N
CertUtil -? -- Display a verb list (command list)
CertUtil -dump -? -- Display help text for the "dump" verb
CertUtil -v -? -- Display all help text for all verbs
and no any link and website help me to resolve this problem. i want to create new database for SIGN firefox addons
It's the first time I'm using an exec with Puppet but I'm not sorting out why it continues returning errors. The command I'm executing consists in a series of symbolic link creations, code is:
exec { "creation_of_symbolic_links":
command => "ln -s link1dest link1name; ln -s link2dest link2name; ... ; ln -s linkNdest linkNname",
path => "/etc", #added just in order to delete an error
}
All linkdests and linknames are absolute paths. The error returned is:
Error: Could not find command 'ln'
Error: /Stage[main]/Main/Node[nodename]/Exec[creation_of symbolic_links]/returns: change from notrun to 0 failed: Could not find command 'ln'
How can I avoid this error?
Please read about the meaning of path parameter in exec resource.
You got an error because path is not properly defined.
Try using:
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ]
I've tried various iterations of using either ", ' and ` to enclose a curl query to an instance of jira in order to get all issues for a particular fix Version.
curl -D- -u username:password -X POST -H "Content-Type: application/json" -d '{"jql":"project = PROJ AND fixVersion=Version-1.2.3"}' "https://thejirainstall.com/jira/rest/api/2/search"
However, using this and a couple of other change on fixVersion such as:
fixVersion="Version-1.2.3"
or
fixVersion=\"Version-1.2.3\"
or
fixVersion=Version-1\u002e2\u002e3
Add and remove quotes at will.
The ones that don't fail outright return:
{"errorMessages":["Error in the JQL Query: '\\.' is an illegal JQL escape sequence. The valid escape sequences are \\', \\\", \\t, \\n, \\r, \\\\, '\\ ' and \\uXXXX. (line 1, character 38)"],"errors":{}}
How do I either escape periods . or add another set of quotes?
Ok, so it turns out that Jira doesn't permit version names in jql syntax. The version id must be used instead.
And, in order to get the version id you must parse the result from https://thejirainstall.com/jira/rest/api/2/project/ON/versions?
This now means that I have to use a JSON parser anyway. So, now I'm using jq via homebrew install jq
My current solution is to write a bash script as below:
JIRA_FIXVERSION
fixVersionQuery='https://thejirainstall.com/jira/rest/api/2/project/ON/versions?';
myJSONResponse=`curl -u username:password -X GET -H "Content-Type: application/json" --insecure --silent $fixVersionQuery |jq '.[] | {id,name} | select(.name=="Version-1.2.3" | .["id"]'`;
echo $myJSONResponse;
I want to upload a file together with some information(e.g. package_type) with curl
in my submission model:
has_attached_file :package
What I tried:
curl -d "submission[package_type]=type1&submission[package]=#/home/ubuntu/Downloads/test.zip" http://localhost:3000/restapi.json
If I leave out the file object, it works(a entry will be inserted into the database)
But I specify the file like above, it gives me an error:
No handler found for "#/home/ubuntu/Downloads/test.zip"
Update:
I just found that that I should use the -F option in curl, but in that case the file information cannot be recorded, is there anyway to include both the file object and file info? Maybe something like curl -d -F ?
I had a similar issue and ended up setting the content-type to multipart/form-data instead of dealing with base64 encoding issues when posting to my REST API. Here is an example which includes headers for auth:
curl -v -H 'Content-Type: multipart/form-data' -H "X-User-Email: <email>" -H "X-User-Token: <token>" -X POST -i -F submission[package_type]=type1 -F submission[image_attributes][image]=#f117.jpg http://localhost:3000/api/v1/submissions