FAQs: Creating an Automatic Server Halt and Run Script for Windows Servers
The script auto_haltrun allows you to halt and run SirsiDynix Symphony and SirsiDynix product agent services from the command line. The AT Scheduler can be used to run the auto_haltrun script on a regular schedule.
![](../../../Resources/Images/template-html5-tripane/important50.png)
Use of the auto_haltrun script and the AT Scheduler should be restricted to very experienced system administrators who are familiar with the Windows Server operating system.
Halt and Run Script
The following script will halt and/or run all of the SirsiDynix Symphony services. The output logs will be placed in the error file. The –debug flag will write extra information to the error file.
auto_haltrun [halt | run] [-debug] [-exclude_agents | -force_agents]
The elements of this script are defined as follows:
• | halt — halts all of the UNICORN services |
• | run — runs all of the UNICORN services |
• | –debug — outputs extra debug information |
• | –exclude_agents — instructs the auto_haltrun script to leave other SirsiDynix product agents unaffected |
• | –force_agents — instructs the auto_haltrun script to ignore the allowhalt value in the agents.cfg file and to halt or run agent processes anyway |
auto_haltrun
If the user types auto_haltrun at the command line, this halts and runs all SirsiDynix Symphony services as well as any services for other SirsiDynix product agents installed on the server.
auto_haltrun halt
If the user types auto_haltrun halt at the command line, this will halt all of the SirsiDynix Symphony services.
auto_haltrun run
If the user types auto_haltrun run –debug at the command line, this will run all of the SirsiDynix Symphony services.
auto_haltrun –debug
If the user types auto_haltrun –debug at the command line, this halts and runs all of the SirsiDynix Symphony services as well as any services for other SirsiDynix product agents installed on the server. The auto_haltrun script also writes extra information to the error file.
auto_haltrun –exclude_agents
If the user types auto_haltrun –exclude_agents at the command line, this will halt and run all of the SirsiDynix Symphony services, but will not affect any other SirsiDynix product agents that are installed on the server.
You can also specify the -debug flag in addition to the -exclude_agents flag if you want the auto_haltrun script to write extra information to the error file.
![](../../../Resources/Images/template-html5-tripane/note50.png)
This flag can only have effect if there is a configured agents.cfg file on your SirsiDynix Symphony server and the file's allowhalt value is set to Y. For information on how to configure this file, see Configuring SirsiDynix agent processes to halt and run using the auto_haltrun script.
auto_haltrun –force_agents
If the user types auto_haltrun –force_agents at the command line, this halts and runs all SirsiDynix Symphony services. This also affects any services for SirsiDynix product agents installed on the server regardless of the value of the allowhalt attribute in the agents.cfg file.
If you want to halt or run SirsiDynix product agent processes while the agents.cfg allowhalt value is set to N, this flag must be specified as part of the auto_haltrun command.
Sample Output
The following report demonstrates the instance of the Task Scheduler Service being set to Manual and having not been started. The command arguments used were as follows.
auto_haltrun -debug
The output generated in the /Unicorn/Logs/Error file is as follows.
UNICORN Socket Server vX.X.X started on Thursday, December 6, 2018, 5:51 PM
20181206175222 ** Error: Unable to start the Task Scheduler service
20181206175222 Changing the ’Task Scheduler service’ from Manual to Automatic...
20181206175222 Starting the Task Scheduler service...
20181206175222 HALTING all of the UNICORN Servers
UNICORN Socket Server finished on Tuesday, January 6, 2009, 5:52 PM
20181206175229 monitor: stopped
20181206175156 UNICORN Monitor vX.X.X started on Tuesday, January 6, 2009, 5:51 PM
UNICORN Socket Server vX.X.X started on Tuesday, January 6, 2009, 5:52 PM
20181206175222 stopping....UNICORN netstarter
20181206175222 stopping....UNICORN webstarter
20181206175222 stopping....UNICORN Sockserver
20181206175222 stopping....UNICORN Reportcron
20181206175229 stopping....UNICORN Starter
20181206175235 stopping....UNICORN Ipcm
20181206175235 stopping....UNICORN marclsnr_starter
20181206175245 RUNNING all of the UNICORN Servers
20181206175245 starting....UNICORN Ipcm
20181206175246 starting....UNICORN Starter
20181206175246 starting....UNICORN Sockserver
20181206175246 starting....UNICORN Reportcron
20181206175246 starting....UNICORN Webstarter
20181206175246 starting....UNICORN Netstarter
20181206175235 starting....UNICORN marclsnr_starter
AT Scheduler
The AT command schedules commands and programs to run on a Windows Server at a specified time and date. The Schedule service must be running to use the AT command. Users can schedule the auto_haltrun script to run on a specified timetable.
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] ”command”
The elements of this script are defined as follows.
• | \\computername – specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted. |
• | id – is an identification number assigned to a scheduled command. |
• | /delete – cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled. |
• | /yes – used with cancel all jobs command when no further confirmation is desired. |
• | time – specifies the time when command is to run. |
• | /interactive – allows the job to interact with the desktop of the user who is logged on at the time the job runs. |
• | /every:date[,...] – runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed. |
• | /next:date[,...] – runs the specified command on the next occurrence of the day (i.e., next Thursday). If date is omitted, the current day of the month is assumed. |
• | “command” – is the Windows Server command or batch program to be run. |
For example, to schedule the command auto_haltrun halt at 3:00 p.m. today, type the following.
AT 15:00 /NEXT: cmd.exe /c “auto_haltrun halt”