
Ways to Login Jenkins using Command line
&
Way to trigger Jenkins job using Command line or script
Wget
Note: If you are using wget 1.11, you might need to use the following options:
wget --auth-no-challenge --http-user=user --http-password=apiToken http://jenkins.yourcompany.com/job/your_job/build?token=TOKEN
With wget 1.10.x the following is enough (but will not work with 1.11.x) :
wget http://user:apiToken@jenkins.yourcompany.com/job/your_job/build?token=TOKEN
ex – wget http://yourserver/job/MyJobname/build?delay=0sec
CURL
Without authentication:
$ curl http://jenkins:8080/job/my%20job/build [ HTML page saying "Authentication required" ]
With authentication:
$ curl --user dbacher:$MY_API_TOKEN http://jenkins:8080/job/my%20job/build [ returns nothing and the build starts ]
curl -X POST http://server/view/name/job/jobname/build?delay=0sec --user 1019352:61bb8531292794315f5dda8113548630
Login Jenkins using groovy script or Perl Script or Java, please refer the reference page…
Reference:
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals