How to set up smartphones and PCs. Informational portal
  • home
  • Windows 10
  • How to terminate the task scheduler program 1c. Turn off your computer automatically

How to terminate the task scheduler program 1c. Turn off your computer automatically

The work of the enterprise and the user almost always requires organization and planning. Many people use third-party organizers and calendars for these purposes. In version 8 of the program, starting with release 8.3.6.1977, the ability to independently create a task scheduler in 1C has been implemented.

For these purposes, the platform has a new tool called "Scheduler".

What is a scheduler

In fact, the "Planner" tool is a collection of a visual field and an object belonging to the built-in language. The appearance of the weekly schedule, created using the "Scheduler", is shown in Fig.1.

Like any object of the built-in language, the Task Scheduler in 1C has a certain set of properties that allows you to programmatically fill it:

  1. Current display periods (by default, the program sets this parameter to the current date of the computer);
  2. Measurements (here you can specify the breakdown of work by divisions, timetables by university groups, opening and lunch hours for shops);
  3. Elements (objects representing tasks to be performed, items, etc.).

At this stage, it is important to understand: The scheduler is not a metadata object and does not store any information. It is just a tool that allows you to display and organize information stored in other places (most often in directories, but you can synchronize it with external tables).

When adding an event to the scheduler window, it is necessary to record the corresponding element of the reference book. Opening the form must re-read the actual data.

Scheduler elements have the following set of characteristics:

  • The beginning and end of the time period of the event;
  • Text content;
  • Picture;
  • Stored value (most often it is a link to an element of the corresponding catalog, but there may be documents as well).

Important! The main condition for the stored data is the presence of two fields with the DATE value type, for setting the start and end points of the event.

Basic actions with the scheduler

Having a window (Fig. 1), you can add a new event. For this:


Fig. 3

  • In particular, clicking on the "Repeat" inscription allows you to set the frequency of the task.

Configuring the display parameters of the task scheduler in 1C

Depending on the needs of the user, the calendar window can be customized in various ways. There are several parameters for this:

  1. Periodic unit;
  2. The multiplicity of the periodic version;
  3. Timeline position.

In the above example, the first variable has a value of 1 hour, the second -7, and the third parameter takes the value at the top.

By combining and experimenting with these props, you can achieve the display that most clearly expresses the task at hand.

It should be noted that in the case when the interval specified by the program exceeds the multiplicity, the timeline will be transferred to the next line.

The appearance can reflect multiple timelines. Its detailed setting allows you to align elements by time intervals with an accuracy of the minute, display the working hours or days as a whole, adjust the visibility of the current time indicator of the system.

By rotating the mouse wheel or the corresponding buttons on the form (if any), you can move along the calendar in the processing window.

Solving some difficulties in the work of the scheduler

In working with the scheduler, as with any other new tool, questions often arise. Let's try to reveal the main ones.

Q: Where can I find the Planner?

Answer: Having created a props of a managed form in platform versions higher than 8.3.6.1977, you can set the type of the scheduler to it (Fig. 4), while in the properties window of the props, you can configure both the time scale and the displayed dimensions and many other parameters.

Question: How do I get the modified data from the form regarding the start and end time of the event?

Answer: In the module, you can register the OnEditingComplete () procedure by binding it to the corresponding form field. In case of editing an existing element, the latter can be obtained using the SelectedElements property;

Question: What code helps to change the currently displayed period?

Answer: On the form, you can create buttons "Day", "Week", "Month", the code below allows you to change the display mode of the calendar (Fig. 5)

Fig. 5

Often, users complain that "1C 8.3 slows down": document forms open slowly, documents are held for a long time, the program is launched, reports are generated for a long time, and so on.

Moreover, such "glitches" can be found in different programs:

The reasons may vary. It is not restored document holding, weak computer or server, incorrectly configured 1C server.

In this article, I want to consider one of the simplest and most common reasons for a slow program -. This instruction will be relevant for users of file databases for 1-2 users, where there is no competition for resources.

If you are interested in more serious optimization of the client-server options for the system operation, visit the section of the site.

Where in 1C 8.3 scheduled tasks

Before I had time to load the program, many background tasks were executed in 1C. You can view them by going to the "Administration" menu, then - "Support and Service":

Get 267 1C video tutorials for free:

This is how the completed tasks window looks like:

And so a complete list of all scheduled tasks that are launched:

Among these tasks are visible such as "", loading various classifiers, checking the relevance of the program version, and so on. For example, almost all of these tasks are useless to me. I do not keep currency accounting, I control the versions myself, load classifiers as needed.

Accordingly, it is in my (and in most cases in your) interests to disable unnecessary tasks.

Disabling scheduled and background jobs in 1C 8.3

When working in 1C, there are many routine operations that must be launched or formed on a schedule by performing this or that action, for example: holding documents or downloading data to 1C from the site.

I recently posted an article: it's time to automate this:

Scheduled and background jobs

The job engine is designed to execute some application or functionality on a schedule or asynchronously.

The task mechanism solves the following tasks:

  • Ability to define routine procedures at the stage of system configuration;
  • Execution of the specified actions according to the schedule;
  • Execution of a call to a given procedure or function is asynchronous, i.e. without waiting for its completion;
  • Tracking the progress of a specific task and getting its completion status (a value indicating the success or failure of its completion);
  • Getting a list of current tasks;
  • The ability to wait for the completion of one or more tasks;
  • Job management (the ability to cancel, blocking of execution, etc.).

The job engine consists of the following components:

  • Metadata of scheduled tasks;
  • Routine tasks;
  • Background jobs;
  • Task Scheduler.

Background jobs & are designed to run application tasks asynchronously. Background jobs are implemented using the built-in language.

Scheduled tasks & are designed to perform application tasks on a schedule. Scheduled tasks are stored in the infobase and are created based on the metadata defined in the configuration. Scheduled job metadata contains information such as name, method, use, etc.

A scheduled job has a schedule that defines at what points in time the method associated with the scheduled job should be executed. The schedule, as a rule, is specified in the infobase, but it can also be specified at the configuration stage (for example, for predefined scheduled tasks).

The task scheduler is used to schedule the execution of scheduled tasks. For each scheduled task, the scheduler periodically checks if the current date and time is on the schedule of the scheduled task. If so, the scheduler assigns such a task to be executed. To do this, for this scheduled task, the scheduler creates a background task that performs the real processing.

With the description, I think that's enough - let's get down to implementation:

Creation of a scheduled job

Method name- path to the procedure that will be executed in the background job according to the specified schedule. The procedure should be in a common module. It is recommended not to use typical common modules, but to create your own. Don't forget that background jobs run on the server!

Usage- a sign of using a scheduled task.

Predetermined- indicates whether the scheduled job is predefined.

If you want the scheduled task to work immediately after being placed in the database, indicate the sign Predetermined... Otherwise, you will need to use the "Job Console" processing or invoke the start of the job programmatically.

Number of retries in case of abnormal completion of the task- how many times the background job was restarted if it was completed with an error.

Retry interval for abnormal job termination- how often the background job will be restarted if it was executed with an error.

Schedule setup

Schedule completing the assignment:

Every hour, just one dayRepeatDays Period = 0, RepeatPeriodDuring a Day = 3600
Every day, once a dayRepeatPeriodDays = 1, RepeatPeriodOverDay = 0
One day, one timeRepeatDays Period = 0
Every other day, once a dayRepeat PeriodDays = 2
Every hour from 01.00 to 07.00 every dayDayRepeatPeriod = 1RepeatPeriodInDay = 3600Start Time = 01.00

End Time = 07.00

Every Saturday and Sunday at 09.00RepeatDays Period = 1DaysWeeks = 6, 7Start Time = 09.00
Every day one week, skip weekRecurrence PeriodDays = 1PeriodWeeks = 2
At 01.00 one timeStart Time = 01.00
The last day of each month is at 9:00.RepeatDays Period = 1DayInMonth = -1Start Time = 09.00
Fifth of every month at 9:00RepeatDays Period = 1DayInMonth = 5Start Time = 09.00
Second Wednesday of every month at 9:00Repeat PeriodDays = 1DayWeekInMonth = 2DaysWeeks = 3

Start Time = 09.00

Specifics of executing background jobs in file and client-server versions

The mechanisms for executing background jobs in the file and client-server versions are different.

In file version you need to create a dedicated client process that will handle the background jobs. To do this, the client process must periodically call the ExecuteJobProcessingGlobal context function. Only one client process per infobase should process background jobs (and therefore call this function). If the client process for processing background jobs has not been created, then when programmatically accessing the job engine, the error "Job manager is not active" will be displayed. It is not recommended that the client process processing background jobs be used for other functions.

After the client process performing background job processing has started, the rest of the client processes can programmatically access the background job engine, i.e. can run and manage background jobs.

In client-server version to execute background tasks, the task scheduler is used, which is physically located in the cluster manager. The scheduler for all queued background jobs gets the least busy workflow and uses it to execute the corresponding background job. The worker process runs the job and notifies the scheduler of the results of the execution.

In the client-server version, it is possible to block the execution of scheduled tasks. Blocking the execution of scheduled tasks occurs in the following cases:

  • An explicit blocking of scheduled jobs is installed on the infobase. The lock can be set through the cluster console;
  • A connection blocking is installed on the infobase. The lock can be set through the cluster console;
  • The SetExclusiveMode () method was called from the embedded language with the True parameter;
  • In some other cases (for example, when updating the database configuration).

Processing of launching and viewing scheduled jobs you can download here.

Probably not a single serious configuration on 1C 8.3 or 8.2 can do without the use of scheduled and background jobs. They are very convenient, since they will be executed according to a clearly defined schedule without user or programmer intervention.

For example, you need to exchange data with another program once a day. Using scheduled and background tasks, 1C will be able to perform these actions on its own, for example, during off-hours. This method will not affect the user experience in any way and will help save time.

First, let's figure out what they mean and what is their difference:

  • Routine task allows you to run any specific actions on a pre-configured schedule.
  • Background job Is an object that contains the actions to be performed.

Suppose our firm sells something and has its own website with prices. We want to unload them once a day to maintain their relevance.

Open the configuration and add a scheduled job.

Setting properties

Let's consider the most important parameters that need to be filled in its properties.

  • In field " Method name»The procedure of a certain general module is selected, which will be directly executed. It will indicate all actions to upload prices to our site. Note that the execution will take place on the server. This is logical, because routine operations are performed without user intervention.
  • The scheduled job can be disabled or enabled as needed. You don't have to change his schedule every time. To do this, set or uncheck the " Usage».
  • Another important thing is the setting whether this scheduled task will be predetermined, or not. Predefined scheduled jobs start automatically. If this sign is not set, then you will need to run them programmatically, or use the "Task Console" processing from the ITS.
  • You can also specify the number of repetitions and the interval between them on abnormal termination. Abnormal termination refers to those situations when the tasks did not work due to an error.

Schedule setup

The final step is to set up the schedule for our upload to the site using the corresponding hyperlink in the properties palette.

You will see a typical schedule setting in 1C 8.3. There is nothing difficult here. As part of this example, we configured the launch of our unloading of prices on the site every day from five to seven in the morning. In the event that the scheduled task does not have time to work out before 7:00, it will be completed the next day.

Blocking scheduled jobs

Run the standard utility "Administration of 1C Enterprise servers" and open the properties of the infobase where you created the scheduled task (for client-server versions of 1C).

In the window that opens (after entering the login and password for access to the IB), check that the flag on the item "Blocking of scheduled tasks is enabled" is not set. If you are faced with a situation where the task does not work out, check this setting first.

In the same way, you can completely disable scheduled tasks in 1C 8.3. To disable specific background jobs, you can use the "Background Job Console" processing built into the latest releases.

Background and scheduled tasks in file mode

In this mode, setting up and running these tasks is much more difficult to organize. Most often, an additional account is created, the session of which will always be open.

In this case, scheduled jobs are activated using the "RunJobProcessing ()" method.

You can also use the following construction:

As the name of the procedure, you must specify the name of the client procedure to be executed. The interval shows how many seconds the execution will take. The "Once" parameter is optional. It reflects whether this procedure will be performed once, or several times.

Tracking errors in background jobs

You can view the progress of background tasks, as well as the presence of possible errors in the log. In the filter, set the filter to the "Background job" application and, if necessary, select the importance of interest, for example, only "Errors".

The log will show all entries that match your selection, with a comment indicating the reason for the error.

Hello.
From the topic it is already clear that it will be about automatic shutdown of the computer... The topic is very relevant both for home and office.

At work, it often happens when an employee leaves his workplace, forgetting to turn off the computer, and sometimes it is necessary to go home, but some tasks are being performed on the computer and the computer cannot be turned off.

After specifying all the settings, click "Apply" or "Ok".

To take full advantage of the Shutdown utility, you must use command line parameters.
To view the parameters for the Shutdown utility, go to the command line (START - All programs - Standard - Command line) and enter the command

Shutdown /? displays help information for the program

Here is one combination of shutting down your computer
C: \ WINDOWS \ system32 \ shutdown.exe -s -f -t 60
Where
-s shutdown local PC
-f allow force close all running applications
-t xx sets the time delay before calling the shutdown procedure in seconds - xx. The default is 20 sec.

Also, some turn off the scheduler when not in use, which reduces the boot time of Windows.
To disable the scheduler, go to the HKLM / SYSTEM / CurrentControlSet / Services / Schedule section in the registry, for the REG_DWORD Start parameter and set the value to 0. To return everything as it was, set the value to 2.

Please leave your opinion in the comments.

P.S. To relax Stalin's joke

Top related articles