A little off topic, because it doesn't use jenkins-cli.jar (-:
When your jenkins ssh port is accessible, you could use something like this:

#!/bin/sh
# check which jenkins jobs are enabled/disabled, using ssh
JENKINS_CONTROLLER=jenkins.my.org
JENKINS_SSH_PORT=2222
JENKINS_USER=jenkins
JOBS=$(ssh -l $JENKINS_USER -p $JENKINS_SSH_PORT $JENKINS_CONTROLLER list-jobs)
for J in $JOBS; do
  STATUS=$(ssh -l $JENKINS_USER -p $JENKINS_SSH_PORT
$JENKINS_CONTROLLER get-job $J|grep disabled)
  if [[ $STATUS = *false* ]]; then
    echo "$J is enabled"
  else
    echo "$J is disabled"
  fi
done

 Cheers, Peter

On Sat, Oct 15, 2022 at 9:47 AM Prakash T <prakashdevv2...@gmail.com> wrote:
>
> Hi , did you find the solution , even i m looking for the same.
>
> On Wednesday, 22 March 2017 at 01:09:41 UTC+5:30 Raj wrote:
>>
>> I would like to know if there is a way to use jenkins cli jar file and find 
>> out if a given job is enabled or currently disabled.
>> i have about 700 jobs on the server and would like to know the list of 
>> enabled and disabled jobs
>>
>> Thank you very much for your time.
>> regards,
>> Raj
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/05d52545-aa84-415f-a121-f1dbd87c7854n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CA%2BEtt0DK9XsOv81QstpTbXtit5MV_%2Bkkxm6T7oDKU%3DGnRwsyMA%40mail.gmail.com.

Reply via email to