{"id":1515,"date":"2019-04-23T22:34:51","date_gmt":"2019-04-24T02:34:51","guid":{"rendered":"http:\/\/mikemartinezonline.com\/blog\/?p=1515"},"modified":"2019-04-23T22:34:51","modified_gmt":"2019-04-24T02:34:51","slug":"stop-unresponsive-service-via-command-line-windows-some-linux-distros","status":"publish","type":"post","link":"https:\/\/mikemartinezonline.com\/blog\/2019\/04\/23\/stop-unresponsive-service-via-command-line-windows-some-linux-distros\/","title":{"rendered":"Stop unresponsive service via command line. (Windows &amp; some Linux distros)"},"content":{"rendered":"<p><strong><font size=\"2\">In Windows:<\/font><\/strong><\/p>\n<p>If you have a service that is not responding or showing pending in Windows services that you are unable to stop, use the following directions to force the service to stop.<\/p>\n<ol>\n<li>Click the <strong>Start <\/strong>menu <\/li>\n<li>Click <strong>Run <\/strong>or in the search bar type <strong>services.msc<\/strong><\/li>\n<li>Press <strong>Enter<\/strong><\/li>\n<li>Look for the service and check the <strong>Properties <\/strong>and identify its service name <\/li>\n<li>Once found, open a command prompt. Type <strong>sc queryex [servicename]<\/strong>. <\/li>\n<li>Press <strong>Enter<\/strong><\/li>\n<li>Identify the PID <\/li>\n<li>In the same command prompt type <strong>taskkill \/pid [pid number] \/f<\/strong><\/li>\n<li>Press <strong>Enter<\/strong><\/li>\n<\/ol>\n<p><strong><font size=\"2\">In Linux (Ubuntu for example)<\/font><\/strong><\/p>\n<p>1. Open the System Monitor app. In the Processes tab, scroll down the list until you find the unresponsive app.<\/p>\n<p><img decoding=\"async\" alt=\"Use the system monitor to kill an unresponsive application in ubuntu\" src=\"https:\/\/www.maketecheasier.com\/assets\/uploads\/2013\/07\/ubuntu-system-monitor.png\" \/><\/p>\n<p>2. Right click on it and select \u201cKill Process\u201d.<\/p>\n<p>Once confirmed, this will kill the unresponsive application.<\/p>\n<p><strong><font size=\"2\">Via Command line:<\/font><\/strong><\/p>\n<p>Open terminal<\/p>\n<p><b>Enter the command to show currently running services.<\/b> Type <kbd>ls \/etc\/init.d<\/kbd> into Terminal and press <kbd>\u21b5 Enter<\/kbd>. This will bring up a list of currently running services and their corresponding command names.<\/p>\n<p>If this command doesn&#8217;t work, try <kbd>ls \/etc\/rc.d\/<\/kbd> instead.<\/p>\n<p><b>Find the command name of the service that you want to restart.<\/b> You&#8217;ll typically find the name of the service (e.g., &quot;Apache&quot;) on the left side of the screen, while the command name (e.g., &quot;httpd&quot; or &quot;apache2&quot;, depending on your Linux distribution) will appear on the right side.<\/p>\n<p><b>Enter the restart command.<\/b> Type <kbd>sudo systemctl restart service<\/kbd> into Terminal, making sure to replace the <kbd>service<\/kbd> part of the command with the command name of the service, and press <kbd>\u21b5 Enter<\/kbd>.<\/p>\n<p>For example, to restart Apache on Ubuntu Linux, you would type <kbd>sudo systemctl restart apache2<\/kbd> into Terminal.<\/p>\n<p><b>Enter your password when prompted.<\/b> Type in the password that you use for your superuser account, then press <kbd>\u21b5 Enter<\/kbd>. This should restart the process.<\/p>\n<p>If the service doesn&#8217;t restart after doing this, try typing in <kbd>sudo systemctl stop service<\/kbd>, pressing <kbd>\u21b5 Enter<\/kbd>, and then entering <kbd>sudo systemctl start service<\/kbd>.<\/p>\n<p>To list running services in the command line:<\/p>\n<p>Use this command:<\/p>\n<p>service &#8211;status-all<\/p>\n<p>Here\u2019s an example of what this looks like on an Ubuntu 16.04.2 LTS system:<\/p>\n<p>root&gt; service &#8211;status-all Example:<\/p>\n<p>[ + ] apache-htcacheclean<\/p>\n<p>[ + ] apache2<\/p>\n<p>[ + ] apparmor<\/p>\n<p>[ &#8211; ] bootmisc.sh<\/p>\n<p>[ &#8211; ] checkfs.sh<\/p>\n<p>[ &#8211; ] checkroot-bootclean.sh<\/p>\n<p>[ &#8211; ] checkroot.sh<\/p>\n<p>[ + ] console-setup<\/p>\n<p>[ + ] cron<\/p>\n<p>[ + ] dbus<\/p>\n<p>[ &#8211; ] hostname.sh<\/p>\n<p>[ &#8211; ] hwclock.sh<\/p>\n<p>[ + ] irqbalance<\/p>\n<p>[ + ] keyboard-setup<\/p>\n<p>[ &#8211; ] killprocs<\/p>\n<p>[ + ] kmod<\/p>\n<p>[ &#8211; ] mountall-bootclean.sh<\/p>\n<p>[ &#8211; ] mountall.sh<\/p>\n<p>[ &#8211; ] mountdevsubfs.sh<\/p>\n<p>[ &#8211; ] mountkernfs.sh<\/p>\n<p>[ &#8211; ] mountnfs-bootclean.sh<\/p>\n<p>[ &#8211; ] mountnfs.sh<\/p>\n<p>[ + ] mysql<\/p>\n<p>[ + ] networking<\/p>\n<p>[ + ] nginx<\/p>\n<p>[ + ] ondemand<\/p>\n<p>[ &#8211; ] plymouth<\/p>\n<p>[ &#8211; ] plymouth-log<\/p>\n<p>[ + ] procps<\/p>\n<p>[ + ] rc.local<\/p>\n<p>[ + ] resolvconf<\/p>\n<p>[ &#8211; ] rsync<\/p>\n<p>[ + ] rsyslog<\/p>\n<p>[ &#8211; ] sendsigs<\/p>\n<p>[ + ] ssh<\/p>\n<p>[ + ] sysstat<\/p>\n<p>[ + ] udev<\/p>\n<p>[ + ] ufw<\/p>\n<p>[ &#8211; ] umountfs<\/p>\n<p>[ &#8211; ] umountnfs.sh<\/p>\n<p>[ &#8211; ] umountroot<\/p>\n<p>[ + ] urandom<\/p>\n<p>[ &#8211; ] uuidd<\/p>\n<p>The meaning of the Ubuntu service command output<\/p>\n<p>From the Ubuntu Linux service man page:<\/p>\n<p>service &#8211;status-all runs all init scripts, in alphabetical order, with the status command. The status is:<\/p>\n<p>[ + ] for running services<\/p>\n<p>[ &#8211; ] for stopped services<\/p>\n<p>[ ? ] for services without a &#8216;status&#8217; command<\/p>\n<p>This option only calls status for sysvinit jobs; upstart jobs can be queried in a similar manner with initctl list. <\/p>\n<p>Some services are managed by Upstart. You can check the status of all <b><i>Upstart<\/i><\/b> services with <b><i>sudo initctl list<\/i><\/b>. Any service managed by Upstart will also show in the list provided by <b><i>service &#8211;status-all<\/i><\/b> but will be marked with <b><i>a<\/i><\/b> ?<\/p>\n<p>[Note: Running with\/without sudo can make a difference.<\/p>\n<p>Some services in \/var\/run\/ have read access only to root user. Those services show status [-] without sudo, and [+] with sudo.]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Windows: If you have a service that is not responding or showing pending in Windows services that you are unable to stop, use the following directions to force the service to stop. Click the Start menu Click Run or in the search bar type services.msc Press Enter Look for the service and check the &hellip; <a href=\"https:\/\/mikemartinezonline.com\/blog\/2019\/04\/23\/stop-unresponsive-service-via-command-line-windows-some-linux-distros\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Stop unresponsive service via command line. (Windows &amp; some Linux distros)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":587,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[175,13,11,256,15,218],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts\/1515"}],"collection":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/users\/587"}],"replies":[{"embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/comments?post=1515"}],"version-history":[{"count":1,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts\/1515\/revisions"}],"predecessor-version":[{"id":1516,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts\/1515\/revisions\/1516"}],"wp:attachment":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/media?parent=1515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/categories?post=1515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/tags?post=1515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}