A classic behavior of the systemctl status command is its tendency to halt automated scripts.
Why systemctl status Halts Automation ?
Explanation:
When we run the sudo systemctl status httpd command in the jumphost or command prompt, the output ends with the message ‘End’ and doesn’t immediately return to the command prompt. Is this why Jenkins fails to proceed to the other servers?
[root@stapp01 tony]# sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
Active: active (running) since Sun 2025-10-12 11:06:57 UTC; 1min 47s ago
Docs: man:httpd.service(8)
Main PID: 3674 (httpd)
Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec: 0 B/sec"
Tasks: 177 (limit: 411140)
Memory: 21.3M
CGroup: /docker/4be4ba9570c23a7158da37ba7a2de461f423f267734da75b9ee69636ab632c4b/system.slice/httpd.service
├─3674 /usr/sbin/httpd -DFOREGROUND
├─3681 /usr/sbin/httpd -DFOREGROUND
├─3682 /usr/sbin/httpd -DFOREGROUND
├─3683 /usr/sbin/httpd -DFOREGROUND
└─3684 /usr/sbin/httpd -DFOREGROUND
Oct 12 11:07:06 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:07:16 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:07:26 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:07:36 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:07:46 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:07:56 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:08:06 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:08:16 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:08:26 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
Oct 12 11:08:36 stapp01.stratos.xfusioncorp.com systemd[1]: httpd.service: Got notification message from PID 3674 (READY=1, STATUS=Total reques>
lines 1-25/25 (END)
Explanation: Why systemctl status Blocks 
The reason your script appears to hang is that systemctl status uses a pager (like less or more) to display the service information.
When you run systemctl status httpd, the output fills the screen, and the shell is put into the interactive pager mode.
In this mode, the terminal shows the message “End” and waits for you to press q (quit) before returning control to the command prompt.
Impact on Jenkins
In an automated environment like Jenkins, the shell script is running non-interactively. The script executes the commands sequentially:
sudo systemctl restart httpd (Completes successfully).
sudo systemctl status httpd (Starts the pager and waits for the non-existent ‘q’ input).
The script hangs here because it’s waiting for interactive input, and the shell never receives the final exit code to proceed to the next server.
The output ending with (END) and not returning to the prompt—means the command is blocking the script’s execution.
The Blocking Command Issue
The systemctl status command uses a utility called a pager (like less or more) to display its output interactively.
Pager Mode: When the output is longer than the screen size (or simply by default on some Linux distributions), systemctl status hands the output to the pager.
Interactive Wait: The pager pauses the script and waits for manual user input (typically the letter q to quit) before returning control to the shell prompt.
Automation Failure: Since the Jenkins job is running the script non-interactively over SSH, it never sends the required ‘q’ input. The script therefore hangs indefinitely on the first server’s build step, preventing the pipeline from moving on to the commands for stapp02 and stapp03.
The Fix: Use the --no-pager Flag
To resolve this issue, you must modify the command in all three of your “Execute shell script on remote host using SSH” steps to disable the interactive pager.
Change the command from:
sudo systemctl restart httpd
sudo systemctl status httpd
To include the --no-pager flag:
sudo systemctl restart httpd && sudo systemctl status httpd --no-pager
To prevent the script from blocking, you must tell systemctl not to use a pager by redirecting its output to a file or by using the --no-pager flag.
By adding --no-pager, the full status output is printed immediately to the console, the command exits with a status code, and the Jenkins build step successfully completes, allowing the job to move sequentially to the next server.
Following is the console output for the manage-services build.
Started by upstream project "nautilus-app-deployment
" build number 1
originally caused by:
Started by user admin
Started by upstream project "nautilus-app-deployment
" build number 1
originally caused by:
Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/manage-services
[SSH] script:
sudo systemctl restart httpd && sudo systemctl status httpd --no-pager
[SSH] executing...
e[0;1;32m●e[0m httpd.service - The Apache HTTP Server
Loaded: loaded (e]8;;file://stapp01.stratos.xfusioncorp.com/usr/lib/systemd/system/httpd.service /usr/lib/systemd/system/httpd.servicee]8;; ; e[0;1;38;5;185mdisablede[0m; preset: e[0;1;38;5;185mdisablede[0m)
Active: e[0;1;32mactive (running)e[0m since Sun 2025-10-12 11:06:57 UTC; 75ms ago
Docs: e]8;;man:httpd.service(8) man:httpd.service(8)e]8;;
Main PID: 3674 (httpd)
Status: "Started, listening on: port 8080"
Tasks: 177 (limit: 411140)
Memory: 21.4M
CGroup: /docker/4be4ba9570c23a7158da37ba7a2de461f423f267734da75b9ee69636ab632c4b/system.slice/httpd.service
├─e[0;38;5;245m3674 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3681 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3682 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3683 /usr/sbin/httpd -DFOREGROUNDe[0m
└─e[0;38;5;245m3684 /usr/sbin/httpd -DFOREGROUNDe[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com httpd[3674]: AH00558: httpd: …ge
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com httpd[3674]: Server configure…80
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Ch…nge[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Jo…nee[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: Started The Apach…r.
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Fa…ere[0m
Oct 12 11:06:57 stapp01.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go…4)e[0m
Hint: Some lines were ellipsized, use -l to show in full.
[SSH] completed
[SSH] exit-status: 0
[SSH] script:
sudo systemctl restart httpd && sudo systemctl status httpd --no-pager
[SSH] executing...
e[0;1;32m●e[0m httpd.service - The Apache HTTP Server
Loaded: loaded (e]8;;file://stapp02.stratos.xfusioncorp.com/usr/lib/systemd/system/httpd.service /usr/lib/systemd/system/httpd.servicee]8;; ; e[0;1;38;5;185mdisablede[0m; preset: e[0;1;38;5;185mdisablede[0m)
Active: e[0;1;32mactive (running)e[0m since Sun 2025-10-12 11:06:59 UTC; 99ms ago
Docs: e]8;;man:httpd.service(8) man:httpd.service(8)e]8;;
Main PID: 3681 (httpd)
Status: "Started, listening on: port 8080"
Tasks: 177 (limit: 411140)
Memory: 20.7M
CGroup: /docker/6482bc16b023b97bc7375a68a604acca0688152c6a9ebd3fcde6d21325e8c05c/system.slice/httpd.service
├─e[0;38;5;245m3681 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3688 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3689 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3690 /usr/sbin/httpd -DFOREGROUNDe[0m
└─e[0;38;5;245m3691 /usr/sbin/httpd -DFOREGROUNDe[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com httpd[3681]: AH00558: httpd: …ge
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com httpd[3681]: Server configure…80
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Ch…nge[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Jo…nee[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: Started The Apach…r.
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Fa…ere[0m
Oct 12 11:06:59 stapp02.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go…1)e[0m
Hint: Some lines were ellipsized, use -l to show in full.
[SSH] completed
[SSH] exit-status: 0
[SSH] script:
sudo systemctl restart httpd && sudo systemctl status httpd --no-pager
[SSH] executing...
e[0;1;32m●e[0m httpd.service - The Apache HTTP Server
Loaded: loaded (e]8;;file://stapp03.stratos.xfusioncorp.com/usr/lib/systemd/system/httpd.service /usr/lib/systemd/system/httpd.servicee]8;; ; e[0;1;38;5;185mdisablede[0m; preset: e[0;1;38;5;185mdisablede[0m)
Active: e[0;1;32mactive (running)e[0m since Sun 2025-10-12 11:07:00 UTC; 78ms ago
Docs: e]8;;man:httpd.service(8) man:httpd.service(8)e]8;;
Main PID: 3045 (httpd)
Status: "Started, listening on: port 8080"
Tasks: 177 (limit: 411140)
Memory: 21.1M
CGroup: /docker/00db1b63b1e48f3fcde8555ade0f8d434df42746dcb31c83cdf5f40f31dba214/system.slice/httpd.service
├─e[0;38;5;245m3045 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3052 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3053 /usr/sbin/httpd -DFOREGROUNDe[0m
├─e[0;38;5;245m3054 /usr/sbin/httpd -DFOREGROUNDe[0m
└─e[0;38;5;245m3055 /usr/sbin/httpd -DFOREGROUNDe[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com httpd[3045]: AH00558: httpd: …ge
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com httpd[3045]: Server configure…80
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go….)e[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Ch…nge[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Jo…nee[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: Started The Apach…r.
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Fa…ere[0m
Oct 12 11:07:00 stapp03.stratos.xfusioncorp.com systemd[1]: e[0;38;5;245mhttpd.service: Go…5)e[0m
Hint: Some lines were ellipsized, use -l to show in full.
[SSH] completed
[SSH] exit-status: 0
Finished: SUCCESS