<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Start/Stop services in different folder directories in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1584679#M11152</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to use this code but I am also getting&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;serviceList = gis_servers.services.list(folder=serverFolder) 

AttributeError: 'list' object has no attribute 'services'&lt;/LI-CODE&gt;&lt;P&gt;I'm not sure how to fix this as my python knowledge is limited. What am I missing?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2025 22:07:29 GMT</pubDate>
    <dc:creator>AndreaB_</dc:creator>
    <dc:date>2025-02-12T22:07:29Z</dc:date>
    <item>
      <title>Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1160318#M7270</link>
      <description>&lt;P&gt;I have looked at and replicated the example here -&amp;gt;&lt;A href="https://support.esri.com/en/technical-article/000019994#:~:text=ArcGIS%20Server%20services%20can%20be%20stopped%20from%20ArcGIS,function%20may%20be%20used%20to%20automate%20the%20process." target="_blank"&gt;How To: Stop GIS services using ArcGIS API for Python (esri.com)&lt;/A&gt;&amp;nbsp;however, this code only seems to return the services that are living in the root folder of my ArcGIS server. I want to stop a different service inside of another folder directory and I am not sure how to do that. I think it may be something simple that I am missing.&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jay&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 16:15:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1160318#M7270</guid>
      <dc:creator>JeremiahJones</dc:creator>
      <dc:date>2022-04-01T16:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1160361#M7271</link>
      <description>&lt;P&gt;Have you seen this?&amp;nbsp;&lt;A href="https://gislab.depaul.edu/portal/portalhelp/en/server/latest/administer/linux/example-stop-or-start-all-services-in-a-folder.htm" target="_blank"&gt;Example: Stop or start all services in a folder—ArcGIS Server Administration (Linux) | Documentation for ArcGIS Enterprise (depaul.edu)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 17:33:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1160361#M7271</guid>
      <dc:creator>tigerwoulds</dc:creator>
      <dc:date>2022-04-01T17:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1160367#M7272</link>
      <description>&lt;P&gt;Actually, once you get the gis server object (gis_servers), you can try something like:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;serverFolder = 'My test folder'&lt;BR /&gt;serviceList &lt;SPAN&gt;= &lt;/SPAN&gt;gis_servers&lt;SPAN&gt;.&lt;/SPAN&gt;services&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;folder&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;serverFolder&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Then loop through that list and execute .start or .stop&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for service in serviceList:
    service.start()
    # service.stop()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 17:48:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1160367#M7272</guid>
      <dc:creator>tigerwoulds</dc:creator>
      <dc:date>2022-04-01T17:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1192283#M7563</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/111548"&gt;@tigerwoulds&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i try what you suggest using the sample code from the tutorial I get:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;AttributeError: 'list' object has no attribute 'services'&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Jul 2022 18:17:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1192283#M7563</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2022-07-14T18:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1236882#M8077</link>
      <description>&lt;P&gt;Thanks! This really worked for me even though I'm a very novice code writer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using ArcGIS API for Python with Notebook in ArcPro and follow these steps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 -Create profile&lt;/P&gt;&lt;P&gt;2-Connect as admin&lt;/P&gt;&lt;P&gt;3- Write following code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Connect to production server federated to Portal
gis_servers = gis.admin.servers.list()[1]
#List all services in Folder1
hosted_services = gis_servers.services.list(folder='Folder1')
#Stop all services in the Folder1
for service in hosted_services:
        service.stop()
#List the status of services in Folder1
service.status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I have four more folders and each one has services in them. How would you write this code to include not only stopping services at the root level but also in the various folders?&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H1&gt;&amp;nbsp;&lt;/H1&gt;</description>
      <pubDate>Thu, 01 Dec 2022 17:37:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1236882#M8077</guid>
      <dc:creator>Jen_Zumbado-Hannibal</dc:creator>
      <dc:date>2022-12-01T17:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1584679#M11152</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to use this code but I am also getting&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;serviceList = gis_servers.services.list(folder=serverFolder) 

AttributeError: 'list' object has no attribute 'services'&lt;/LI-CODE&gt;&lt;P&gt;I'm not sure how to fix this as my python knowledge is limited. What am I missing?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 22:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1584679#M11152</guid>
      <dc:creator>AndreaB_</dc:creator>
      <dc:date>2025-02-12T22:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop services in different folder directories</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1585075#M11158</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;You all have helped me a quite a bit. Through this post and many other posts along with documentation, I was able to piece together full code to stop all of my services. I am posting here to help others in the future.&amp;nbsp; Is there a better way to do it? Well, I was hoping so! But at least this works.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
import arcgis.gis.admin
gis = GIS("portalurl", "username") #GIS Server details
admin = gis.admin
server1 = gis.admin.servers.get(role="HOSTING_SERVER")[0] #get federated ArcGIS Server
#stop root folder services
for service in server1.services.list():
    service.stop()
#stop all services in this folder
for service in server1.services.list(folder="folder1"):
    service.stop()
#stop all services in this folder
for service in server1.services.list(folder="folder2"):
    service.stop()
#stop all services in this folder
for service in server1.services.list(folder="folder3"):
    service.stop()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 18:19:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/start-stop-services-in-different-folder/m-p/1585075#M11158</guid>
      <dc:creator>AndreaB_</dc:creator>
      <dc:date>2025-02-13T18:19:57Z</dc:date>
    </item>
  </channel>
</rss>

