.title "Automatic Server Shutdown/Restart" .id 314120060307121912 .tags "manual" .body { [h1 "Automatic Server Shutdown/Restart"] [p { This script runs a NewViews server and every 24 hours, at a specified time of day, shuts the server down and restarts it. }] [p { Shutting the server down will [bold "kick out"] all workstations attached to the server at the time of shutdown. The user of a kicked out workstation will have an appropriate error message on their screen, indicating that they have lost a connection to the server. }] [p { In any case, it is not a good practice for users to leave their workstations running unattended for any significant period of time. Security issues are involved. }] [h2 "Setting up to run this script."] [p { For the purpose of illustration we assume that NewViews is installed in directory [qw_directory c:/nv] on the computer that will run the NewViews server. This puts the server database in directory [qw_directory c:/nv/server]. This script assumes that the server database is in the server subdirectory of the installation directory. Contact us if this an issue. }] [p { The command line to run this script from a command prompt will be: }] [p { [pre { c:/nv>nv2 -script c:/nv/nv2.exe/custom/tenaska_server_shutdown.qw_script }] }] [p { You can also edit the properties for the Windows start menu for the [qw_menu_command "NewViews" "Server"] command. Change the shortcut target line to: }] [p { [pre { nv2.exe -script c:/nv/nv2.exe/custom/tenaska_server_shutdown.qw_script }] }] [p { Note that you must remove the [bold -server] option from the original line. Note also that whenever you download and install a new version of NewViews the shortcut line is replaced by the installation. So after installing you will have to edit the properties again. }] [p { Note, if you look at the processes in the Windows task manager, you will see two tasks with the name nv2. One will be for the server itself, and one will be for the NewViews process that is running this script to control it. }] [h2 "How to use the script to start the server."] [p { When you run this script a prompt will appear. It contains some help text and a time entry field so that you can change the time of day for the shutdown. Click the [qw_button "Start Server"] button to run the server. The prompt will disappear and the server will appear as usual. }] [p { The server will run as usual, but once a day at the specified time, the server will automatically shut down and restart. }] [h2 "How to manually shut down the server."] [p { You can shut down the server manually by issuing the [qw_menu_command "File" "Exit NewViews"] command or by clicking on the main server window close button. If you shut down the server in this way, it will not restart automatically. Note that if this were not the case, then there would be no way to stop the server. }] [p { To start the server again just run it again as described earlier, and it will again shutdown/restart once a day at the specified time. }] [h2 "Time of the shutdown."] [p { You can change the time that the server will shutdown/restart in the script prompt to any time of day. The script is shipped with a default of 12:01:00 AM, i.e. one minute after midnight. We recommend against scheduling anything at exactly midnight to avoid potential confusion. }] }