Architecting, installing and maintaining your SAS environment

Start/Stop all SAS Services using batch file (Windows)

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 96
Accepted Solution

Start/Stop all SAS Services using batch file (Windows)

Hi All,

 

I want to share a new idea to manage all sas services in windows using batch, 

 

In Linux or Z/OS we can use sas.servers script to operate all SAS Servers from just one command (./sas.servers start/stop),
But for windows, we don’t have any script like that,

 

So I have created two batch files to start and stop all SAS Services with other SAS services dependencies ,

And in my testing environment, it is working fine,


I have attached that two scripts in attachment , any feedback, suggestions and questions on this topic would be really appreciated.Smiley Happy

 

Please find below GIF to see how these scripts work.

Start SAS services script :

 

Start_Services.gif

 

Stop SAS services script :

 Stop_Services.gif

Attachment

Accepted Solutions
Solution
‎08-09-2017 12:13 PM
Frequent Contributor
Posts: 96

Re: Start/Stop all SAS Services using batch file (Windows)

Hello @SASKiwi;

 

Thanks for your valuable feedback Smiley Happy !

 

Currently, in this script, I am using sc start/stop [Service_Name] command to operate the services,

 

But yes, we can also operate the SAS Environment Manager Agent using hq-agent.bat file,

We have to change this line from .bat file :

 

Spoiler

sc start/stop "SAS [%variable%-Lev1] SAS Environment Manager Agent" >nul 

 

to this lines:

 

 

Spoiler

 pushd "D:\SAS\SASConfig\Lev1\Web\SASEnvironmentManager\agent-5.8.0-EE\bin" >nul

call hq-agent.bat start/stop >nul

popd >nul

 

After that, it will operate SAS Environment Manager Agent service using the hq-agent.bat file.

 

Thanks,

Kalind

 

View solution in original post


All Replies
Super User
Posts: 3,260

Re: Start/Stop all SAS Services using batch file (Windows)

Posted in reply to Kalind_Patel

Thanks for the post. We have a very similar scripted process for our Windows SAS servers. It is frustrating that SAS does not provide this, nor is it very well documented what you need to do. We built our version through trial and error and help from our SAS installer.

 

BTW SAS recommend you start and stop Environment Manager agent using the hq-agent.bat file and not by starting the service directly- is this what you do?   

Solution
‎08-09-2017 12:13 PM
Frequent Contributor
Posts: 96

Re: Start/Stop all SAS Services using batch file (Windows)

Hello @SASKiwi;

 

Thanks for your valuable feedback Smiley Happy !

 

Currently, in this script, I am using sc start/stop [Service_Name] command to operate the services,

 

But yes, we can also operate the SAS Environment Manager Agent using hq-agent.bat file,

We have to change this line from .bat file :

 

Spoiler

sc start/stop "SAS [%variable%-Lev1] SAS Environment Manager Agent" >nul 

 

to this lines:

 

 

Spoiler

 pushd "D:\SAS\SASConfig\Lev1\Web\SASEnvironmentManager\agent-5.8.0-EE\bin" >nul

call hq-agent.bat start/stop >nul

popd >nul

 

After that, it will operate SAS Environment Manager Agent service using the hq-agent.bat file.

 

Thanks,

Kalind

 

Super Contributor
Posts: 298

Re: Start/Stop all SAS Services using batch file (Windows)

Posted in reply to Kalind_Patel
Thank you, it was something like that I needed when I updated to SAS 9.4M4 a few days ago.
Frequent Contributor
Posts: 96

Re: Start/Stop all SAS Services using batch file (Windows)

Posted in reply to JacobSimonsen

Welcome @JacobSimonsen  Smiley Happy !

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 1727 views
  • 13 likes
  • 3 in conversation