Disclaimer
This article expresses the personal opinion of the author, his vision of the world, his path, and all this does not claim to be absolute loyalty and objectivity. The author does not bear any responsibility for the consequences of using this information, he only hopes that this information will help to make life easier for someone.
Foreword
At first, I just wanted to write a short article about how we distributed databases by services, but during the deepening of this process we added all sorts of different things (monitoring services, then monitoring users inside 1C, then screwing in zabbiks, and finally came to CI / CD based on 1C). As a result, I understand that it will be too much to push this into one article - I decided to divide it into several. Well, the name is inspired by a cycle of articles "networks for the smallest," which brought me many pleasant minutes and to which I refer everyone who "wants to explore the networks." So, we proceed!
When you acknowledge the problem, it means that youβve already half recovered (c) a friend psychiatrist
In this article I want to share my experience in administering a large number of 1C in the corporate sector. The bases are all different, there is development, there is a test, everything is like at all. But there are just enough of them. And everything was fine, but at a certain moment it was extremely difficult and risky to carry out some kind of admin work.
What were our difficulties:
A slight distraction to the basic postulates, the awareness of which was given a lot of blood and pain.
The first short scene from corporate life
On the stage - Admin (A), 1C programmer (P1C) and business representative (PB)
PB - The program is slow!
A - I'm fine in the system!
P1C - I wrote everything correctly, everything works fast on my computer!
PB (timidly and perplexedly) - but itβs a long time ...
A and P1C choir - we are fine, the problem is on your side!
Problems always happen at the wrong time (s) (5-year-old philosopher)
And one fine sunny morning (in fact, it was a deep winter night), we realized that tomorrow we need to launch a new base. Tomorrow came that wonderful day, which has already been described many times by thousands of authors and his name is legion! Ugh, sorry, skidded. The name of this day was the deadline. One o'clock at night, tomorrow a new database should start on 200 computers. "Yes, no problem, we have all the computers in the domain! Now weβll quickly make a login script and it's in the bag!" you think. And you will be right - we also thought. And they did. Only, as it usually happens, you got burned on trifles - I registered in% logon script% filename%. bat and a colleague posted% filename%. cmd
Well, of course, in the morning Helpdesk ran to do everything with my hands, and I was very ashamed of such a stupid Fail. Apologized to the guys cake.
But the thought of automating this process in my head sat down very firmly and even the implementation plan began to emerge.
As a result, we come to the following ideology:
How we did it:
#
if (Test-Path "$env:HOMEDRIVE\!script_report\add_1c_bases_report.txt")
{
Remove-Item "$env:HOMEDRIVE\!script_report\add_1c_bases_report.txt" -Force -ErrorAction SilentlyContinue;
}
New-Item "$env:HOMEDRIVE\!script_report\add_1c_bases_report.txt" -ItemType file -Force -ErrorAction SilentlyContinue;
Add-Content -Value (" : " + (Get-Date -Format F)) -Path "$env:HOMEDRIVE\!script_report\add_1c_bases_report.txt";
if ( (gwmi Win32_OperatingSystem | select Caption, CSDVersion) -notlike "*server*") #
{
Add-Content -Value " " -Path "C:\!script_report\add_1c_bases_report.txt";
if (!(Test-Path "$env:APPDATA\1C\1CEstart\ibases.v8i")) # 1 8.1 8.2
{
New-Item "$env:APPDATA\1C\1CEstart\ibases.v8i" -ItemType file -Force; #
Add-Content -Value " $env:APPDATA\1C\1CEstart\ibases.v8i , " -Path "C:\!script_report\add_1c_bases_report.txt";
}
if (Test-Path "$env:APPDATA\1C\1CEstart\1CEStart.cfg")
{
Remove-Item "$env:APPDATA\1C\1CEstart\1CEStart.cfg" -Force #-ErrorAction SilentlyContinue # 8.1
}
New-Item "$env:APPDATA\1C\1CEstart\1CEStart.cfg" -ItemType file -Force # 8.2
$GroupList = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$','$1' #
foreach ($Group in $GroupList) #
{
if ($Group.Length -gt 6) #
{
If ($Group.Substring(0,7) -eq "1cbases") # 1
{
Switch ($Group.Substring(8,2)) # 8.1 8.2
{
"81" {Add-Content "$env:APPDATA\1C\1Cv81\ibases.v8l" -Value ("\\gold585.int\TechFiles\CommonBases\" + $Group.Substring(11) +".v8i")} # 8.1
"82" {Add-Content "$env:APPDATA\1C\1CEstart\1CEStart.cfg" -Value ("CommonInfoBases=\\gold585.int\TechFiles\CommonBases\" + $Group.Substring(11) +".v8i")} # 8.2
"83" {Add-Content "$env:APPDATA\1C\1CEstart\1CEStart.cfg" -Value ("CommonInfoBases=\\gold585.int\TechFiles\CommonBases\" + $Group.Substring(11) +".v8i")} # 8.3
}
Add-Content -Value (" $Group") -Path "C:\!script_report\add_1c_bases_report.txt";
Add-Content -Value (" : CommonInfoBases=\\gold585.int\TechFiles\CommonBases\" + $Group.Substring(11) +".v8i") -Path "C:\!script_report\add_1c_bases_report.txt";
}
}
}
}
else
{
Add-Content -Value " " -Path "C:\!script_report\add_1c_bases_report.txt";
}
:
β (), 1 (1),
β 1 β $#%!!! !
1 β #$@! ! !
, , .
β¦ () -
β , , , β¦ , , ! β , %@!
β ?
β . % % , , . 3 . .
β !!!
β , ...
, , .
:
( . ):
:
@echo off
chcp 1251
set base=%base_name%
β
set dsce=%base name%
β
set dscr=% %
β
set sver=8.3
β
set fver=1cv8\8.3.9.2170
1
set port=8040
set regp=8041
set rnge=8060:8491
set name="1C:Enterprise %sver% Server Agent (x86-64) %dsce%"
( ) ,
set bpth=\"C:\Program Files\%fver%\bin\ragent.exe\" -srvc -agent
set logs=D:\1C_Server_%base%
set user="%login%@%domain_name%"
20
, , ;
set view=" 1: %sver% (x86-64) %dscr%"
sc create %name% binPath= "%bpth% -regport %regp% -port %port% -range %rnge% -d \"%logs%\"" type= "own" start= "auto" error= "severe" depend= "Tcpip/Dnscache/lanmanworkstation/lanmanserver" obj= %user%DisplayName= %view%
:
type= "own" β ,
start= "auto" β
error= "severe" β , ErrorControl = 2
depend= "Tcpip/Dnscache/lanmanworkstation/lanmanserver" β ( , )
sc description %name% %view%
,
sc failure %name% reset= 0 actions= "restart/0"
β , 0 ; 0
:
@echo off
chcp 1251
set base=%base_name%
set dsce=%base name%
set dscr=% %
set sver=8.3
set fver=1cv8\8.3.9.2170
set port=8040
set regp=8041
set rnge=8060:8491
set name="1C:Enterprise %sver% Server Agent (x86-64) %dsce%"
set bpth=\"C:\Program Files\%fver%\bin\ragent.exe\" -srvc -agent
set logs=D:\1C_Server_%base%
set user="%login%@domain.company"
set view=" 1: %sver% (x86-64) %dscr%"
sc create %name% binPath= "%bpth% -regport %regp% -port %port% -range %rnge% -d \"%logs%\"" type= "own" start= "auto" error= "severe" depend= "Tcpip/Dnscache/lanmanworkstation/lanmanserver" obj= %user% DisplayName= %view%
sc description %name% %view%
sc failure %name% reset= 0 actions= "restart/0"
:
:
( ):
UPD. -
Source: https://habr.com/ru/post/358410/