1C Creating InfoBases via RAS

PowerShell script below:

$infobase = "base_name"

$sql_server_host = "sqlhost"
$sql_user_login = "sql_login"
$sql_user_password = "sql_password"

$odin_s_rac = '"C:\Program Files\1cv8\8.3.8.1652\bin\rac.exe"'
# --create-database

$cluster_id = . $odin_s_rac cluster list |
Select -first 1 |
ForEach-object { $_.Trim("cluster                       :") }

. $odin_s_rac infobase `
--cluster=$cluster_id create  `
--name=$infobase `
--dbms=MSSQLServer `
--db-server=$sql_server_host `
--db-name=$infobase `
--db-user=$sql_user_login `
--db-pwd=$sql_user_password `
--scheduled-jobs-deny=on `
--license-distribution=allow `
--locale=ru

$InfoBasePath = "Srvr=`"servername`";Ref=`"$($infobase)`";"

Write-Host $InfoBasePath

Write  $InfoBasePath | clip
Posted by admin in 1C

1C server infobases list view script

The script is below:

$ib_list = @()
$re_SrvInfo                                     =   '-d\s+"([\w\d\:\\\s]+?)"'
$re_Port                                        =   '{[\w\d]{8}-([\w\d]{4}-){3}[\w\d]{12},"*.*?"*,(\d+)'
$re_C1_InfoBase                                 =   '{([\w\d]{8}-[\w\d]{4}-[\w\d]{4}-[\w\d]{4}-[\w\d]{12}),"(.*?)",".*?","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?DB=.*?DBMS=.+),.,\n{\d,\d{14},\d{14},.*},(\d),.*}'

$C1CommandLine                                  =   Get-WmiObject Win32_Process -Filter "name = 'ragent.exe'" | Select-Object CommandLine
$C1CommandLine                                  |   % {
    if ($_ -match $re_SrvInfo){
        $C1SrvInfoDir                           =   $Matches[1]
        $C1_1cv8wsrv                            =   "$C1SrvInfoDir\1cv8wsrv.lst"
        $C1_1cv8wsrv_content                    =   Get-Content -Path $C1_1cv8wsrv -Encoding UTF8
        foreach($line in $C1_1cv8wsrv_content -match $re_Port){
            if($line -match $re_Port){
                $c1_port_dir                    =   "$C1SrvInfoDir\reg_"+$Matches[2]
                $c1_cluster_content             =   Get-Content -Raw -Path "$c1_port_dir\1CV8Clst.lst"
                $c1_cluster_content = $c1_cluster_content.Replace("`r`n","`n")
                $ibs = $c1_cluster_content | Select-String $re_C1_InfoBase -AllMatches | Foreach {$_.Matches}
                
                # write-host $ibs
                foreach($base in $ibs){
                    write-host $base.GetType() $base.Groups[2]  $base.Groups[1]  $base.Groups[6]  $base.Groups[9]                    
                    $ib_guid = $base.Groups[1]
                    $ib_block_bjob = $base.Groups[9]
                    $ib_name = $base.Groups[2]
                    $ib_dbms = $base.Groups[3]
                    $ib_dbsrv = $base.Groups[4]
                    $ib_dbname = $base.Groups[5]
                    $ib_dbuser = $base.Groups[6]
                                   
                    $ib_list += ([ordered]@{"IB NAME"=$ib_name; "BLOCK BJ"=$ib_block_bjob; "IB GUID"=$ib_guid; "IB DBMS"=$ib_dbms; "IB DB SRV"=$ib_dbsrv; "IB DBNAME"=$ib_dbname; "IB DB USER"=$ib_dbuser})
                }                                   
            }
        }
    }
}

$ib_list = $ib_list | % { New-Object object | Add-Member -NotePropertyMembers $_ -PassThru }

$Result = $ib_list | Out-GridView -PassThru  -Title '1C Server IB List'
Posted by admin in 1C

Create custom service for 1C:Enterprise Server Agent

bat script for agent:

@echo off

set odin_s_version=8.3.16.1296
set port_prefix=16

set service_name="1C:Enterprise Server Agent %odin_s_version%"
set binPathVar="\"C:\Program Files\1cv8\%odin_s_version%\bin\ragent.exe\" -srvc -agent -regport %port_prefix%41 -port %port_prefix%40 -range %port_prefix%60:%port_prefix%91 -d \"C:\1c_srvinfo_custom\%odin_s_version%\" -debug"


sc create %service_name% binPath= %binPathVar% start= auto displayname= %service_name%
sc description %service_name% %service_name%
sc start %service_name%

bat script for ras server

@echo off

set odin_s_version=8.3.16.1814
set port_prefix=16

set service_name="1C:Enterprise Remote Server %odin_s_version%"
set binPathVar="\"C:\Program Files\1cv8\%odin_s_version%\bin\ras.exe\" cluster --service --port=%port_prefix%45 localhost:%port_prefix%40"

sc create %service_name% binPath= %binPathVar% start= auto displayname= %service_name%
sc description %service_name% %service_name%
sc start %service_name%
Posted by admin in 1C

Installing Docker Engine on Ubuntu 20.04 in one command

sudo apt-get remove -y docker docker.io containerd runc \
&& sudo apt-get update \
&& sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --batch --yes --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli docker-compose-plugin containerd.io \
&& sudo docker run --rm hello-world
Posted by admin in Linux, 0 comments

Creating Proxmox Cloud-Init VM Ubuntu 20.04

All in one step
wget https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img \
  && qm create 9020 --memory 2048 --net0 virtio,bridge=vmbr0,tag=18 --agent enabled=1 --cores 2 --ostype l26 --name ubuntu20-template \
  && qm importdisk 9020 focal-server-cloudimg-amd64.img local-lvm \
  && qm set 9020 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9020-disk-0 \
  && qm resize 9020 scsi0 +8G \
  && qm set 9020 --scsi0 local-lvm:base-9120-disk-0,mbps_rd=100,mbps_wr=100,iops_rd=100,iops_wr=100 \
  && qm set 9020 --scsi2 local-lvm:cloudinit \
  && qm set 9020 --boot c --bootdisk scsi0 \
  && qm set 9020 --serial0 socket --vga serial0 \
  && echo Finished
Continue reading →
Posted by admin, 0 comments