1 Star 0 Fork 54

Ryouj/kasini3000

forked from chuanjiao10/kasini3000 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.ps1 12.54 KB
一键复制 编辑 原始数据 按行查看 历史
chuanjiao10 提交于 2023-07-15 14:05 . 本软件开源4周年啦!
#建议保存编码为:bom头 + utf8
if ($global:kasini3000_config -eq $true)
{
exit
}
$global:kasini3000_config = $true
if ($IsLinux -eq $True)
{
$global:kasini3000目录 = '/etc/kasini3000' #kasini3000 main folder
$global:主控机db目录 = "${global:kasini3000目录}/cmdb" #kasini3000 cmdb folder
$global:主控机库目录 = "${global:kasini3000目录}/lib" #kasini3000 lib folder
$global:主控机脚本目录 = "${global:kasini3000目录}/master_script" #kasini3000 master script folder
$global:被控机脚本目录 = "${global:kasini3000目录}/node_script" #kasini3000 node script folder
if ($global:kasini3000_data_path)
{
}
else
{
$global:kasini3000_data_path = "/root/kasini3000"
}
if (Test-Path -LiteralPath $global:kasini3000_data_path)
{
}
else
{
mkdir $global:kasini3000_data_path
mkdir "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/fubao.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/fubao_rs.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/user_crontab_mp.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/user_crontab_mt.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
mkdir "${global:kasini3000_data_path}/ssh_key_files_old1"
mkdir "${global:kasini3000_data_path}/ssh_key_files_old2"
jl建立主控机ssh秘钥1z.ps1
gx更新主控机ssh秘钥2z.ps1
mkdir "${global:kasini3000_data_path}/high_available"
Copy-Item -LiteralPath "${global:kasini3000目录}/docs/examples/nodelist.csv" -Destination $global:kasini3000_data_path
}
$global:卡死你3000日志文件全路径 = "${global:kasini3000_data_path}/卡死你3000日志文件.txt"
if (Test-Path -LiteralPath "${global:kasini3000_data_path}/cmdb")
{
}
else
{
mkdir "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/fubao.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/fubao_rs.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/user_crontab_mp.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}/cmdb/y原始库/user_crontab_mt.sqlite3" -Destination "${global:kasini3000_data_path}/cmdb"
}
if ($global:ssh_private_key_file1_path)
{
}
else
{
$global:ssh_private_key_file1_path = '/root/.ssh/id_rsa'
}
if ($global:ssh_private_key_file2_path)
{
}
else
{
$global:ssh_private_key_file2_path = "${global:kasini3000_data_path}/ssh_key_files_old1/id_rsa"
}
if (Test-Path -LiteralPath "${global:kasini3000_data_path}/ssh_key_files_old1")
{
}
else
{
mkdir "${global:kasini3000_data_path}/ssh_key_files_old1"
jl建立主控机ssh秘钥1z.ps1
gx更新主控机ssh秘钥2z.ps1
}
if (Test-Path -LiteralPath "${global:kasini3000_data_path}/ssh_key_files_old2")
{
}
else
{
mkdir "${global:kasini3000_data_path}/ssh_key_files_old2"
}
if ($global:被控机列表文件)
{
}
else
{
$global:被控机列表文件 = "${global:kasini3000_data_path}/nodelist.csv" #kasini3000 node list file
}
if (Test-Path -LiteralPath $global:被控机列表文件)
{
}
else
{
Copy-Item -LiteralPath "${global:kasini3000目录}/docs/examples/nodelist.csv" -Destination $global:kasini3000_data_path
}
}
#----------------------------------------------------------------------------------------------------------------------
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
$global:kasini3000目录 = 'c:\ProgramData\kasini3000'
$global:主控机db目录 = "${global:kasini3000目录}\cmdb"
$global:主控机库目录 = "${global:kasini3000目录}\lib"
$global:主控机脚本目录 = "${global:kasini3000目录}\master_script"
$global:被控机脚本目录 = "${global:kasini3000目录}\node_script"
$global:主控机admin_gui目录 = "${global:kasini3000目录}\admin_gui"
if ($global:kasini3000_data_path)
{
}
else
{
$global:kasini3000_data_path = "${env:USERPROFILE}\Documents\kasini3000"
}
if (Test-Path -LiteralPath $global:kasini3000_data_path)
{
}
else
{
mkdir $global:kasini3000_data_path
mkdir "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\fubao.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\fubao_rs.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\user_crontab_mp.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\user_crontab_mt.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
mkdir "${global:kasini3000_data_path}\ssh_key_files_old1"
mkdir "${global:kasini3000_data_path}\ssh_key_files_old2"
jl建立主控机ssh秘钥1z.ps1
gx更新主控机ssh秘钥2z.ps1
Copy-Item -LiteralPath "${global:kasini3000目录}\docs\examples\nodelist.csv" -Destination $global:kasini3000_data_path
}
$global:卡死你3000日志文件全路径 = "${global:kasini3000_data_path}\卡死你3000日志文件.txt"
if (Test-Path -LiteralPath "${global:kasini3000_data_path}\cmdb")
{
}
else
{
mkdir "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\fubao.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\fubao_rs.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\user_crontab_mp.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
Copy-Item -LiteralPath "${global:kasini3000目录}\cmdb\y原始库\user_crontab_mt.sqlite3" -Destination "${global:kasini3000_data_path}\cmdb"
}
if ($global:ssh_private_key_file1_path)
{
}
else
{
$global:ssh_private_key_file1_path = "${env:USERPROFILE}\.ssh\id_rsa"
}
if ($global:ssh_private_key_file2_path)
{
}
else
{
$global:ssh_private_key_file2_path = "${global:kasini3000_data_path}\ssh_key_files_old1\id_rsa"
}
if (Test-Path -LiteralPath "${global:kasini3000_data_path}\ssh_key_files_old1")
{
}
else
{
mkdir "${global:kasini3000_data_path}\ssh_key_files_old1"
jl建立主控机ssh秘钥1z.ps1
gx更新主控机ssh秘钥2z.ps1
}
if (Test-Path -LiteralPath "${global:kasini3000_data_path}\ssh_key_files_old2")
{
}
else
{
mkdir "${global:kasini3000_data_path}\ssh_key_files_old2"
}
if ($global:被控机列表文件)
{
}
else
{
$global:被控机列表文件 = "${global:kasini3000_data_path}\nodelist.csv" #kasini3000 node list file
}
if (Test-Path -LiteralPath $global:被控机列表文件)
{
}
else
{
Copy-Item -LiteralPath "${global:kasini3000目录}\docs\examples\nodelist.csv" -Destination $global:kasini3000_data_path
}
}
#----------------------------------------------------------------------------------------------------------------------
$global:linux秘钥同步频率 = '天' # Sync linux pub key file frequency between master and node.'天' = one day. '无' = none. other string = erery time.
#----------------------------------------------------------------------------------------------------------------------
$global:kcommit最大并发进程数 = 99 #max count limit for run simultaneously job by k-commit.ps1
$global:kcommit每次执行任务数 = 100 # To-be-run records read from the database each time
#$global:kaiiit后台任务_循环间隔_秒 = 9 # time interval for kaiiit
#----------------------------------------------------------------------------------------------------------------------
$global:kcommitrs最大并发线程数_进程数_乘以_线程数_总和 = 300 # max count for run simultaneously job by k-commit-rs.ps1 in all process.
$global:kcommitrs并发线程数_单进程 = 50 # max count for run simultaneously job by k-commit-rs.ps1 in single process.
$global:kcommitrs每次执行任务数 = 60 # To-be-run records read from the database each 10 second.
$global:kcommitrs_ps版本 = $global:p_w_s_h_7
#$global:kaiiitrs后台任务_循环在_秒 = 12,12,22,32,42,52 # time interval for kaiiitrs
#----------------------------------------------------------------------------------------------------------------------
$global:k库_定时任务_每次执行任务数 = 10 #start new kasini3000 tasks count every cycle #After each loop time,kasini3000 start [number] count of new tasks
#----------------------------------------------------------------------------------------------------------------------
$global:启用excelnodelist = $true # enable excel nodelist. Charging plugin, 20$.
$global:excel版_被控机列表文件 = "${global:kasini3000_data_path}/nodelist.xlsx"
#----------------------------------------------------------------------------------------------------------------------
$global:启用_win密码加密版_nodelist = $false #
$global:win密码加密版_nodelist = "${global:kasini3000_data_path}/nodeliste.csv"
#----------------------------------------------------------------------------------------------------------------------
$global:u库_进程级别_定时任务_被控机列表文件 = "${global:kasini3000_data_path}/nodelist.csv"
$global:u库_进程级别_定时任务_最大并发进程数 = 99 #max count for run simultaneously job limit by u库_计划表_添加动作331.ps1
$global:u库_进程级别_定时任务_每次执行任务数 = 10 #start new user tasks count every cycle
$global:u库_进程级别_定时任务_超时 = New-TimeSpan -Hours 6 -Minutes 1 # time over process-level scheduled tasks
$global:u库_进程级别任务_的ps版本 = $global:p_w_s_h_7 #psversion ,$global:p_w_s_h_7,$global:p_w_s_h_6,$global:p_w_s_h
$global:u库_进程级别_定时任务_循环在_秒 = 1,11,21,31,41,51 #User timed loop tasks run at second every minute
#----------------------------------------------------------------------------------------------------------------------
#$global:u库_线程级别_定时任务_启用 = $false # if true,Enable thread-level scheduled tasks
$global:u库_线程级别_定时任务_启用 = $true
$global:u库_线程级别_定时任务_被控机列表文件 = "${global:kasini3000_data_path}/nodelist.csv"
$global:u库_线程级别_定时任务_最大并发线程数_所有进程的线程数总和 = 996 #max count for thread-level scheduled tasks,all process limit
$global:u库_线程级别_定时任务_最大并发线程数_单进程 = 90 #max count for thread-level scheduled tasks,one process limit
$global:u库_线程级别_定时任务_每次执行任务数 = 50 #start thread-level tasks count every cycle
$global:u库_线程级别_定时任务_超时 = New-TimeSpan -Hours 2 -Minutes 1 #time over thread-level scheduled tasks
$global:u库_线程级别任务_的ps版本 = $global:p_w_s_h_7 #psversion ,$global:p_w_s_h_7,$global:p_w_s_h_6,$global:p_w_s_h
$global:u库_线程级别_定时任务_循环在_秒 = 6,16,26,36,46,56 #User timed loop tasks run at second every minute
#----------------------------------------------------------------------------------------------------------------------
$global:被控机密码_变更周期 = New-TimeSpan -Days 30 #win node change pwd cycle
$global:被控机秘钥_变更周期 = New-TimeSpan -Days 60 #linux node change ssh key cycle
#----------------------------------------------------------------------------------------------------------------------
$global:用户config文件路径 = "${global:kasini3000_data_path}/user_config.ps1" # user custom config file path.
#$global:variablename = 'xxx'
if ($global:kasini3000_user_config -eq $true)
{
# user custom config file allready load. only exec once.
}
else
{
$global:kasini3000_user_config = $true
if (Test-Path -LiteralPath $global:用户config文件路径)
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Verbose "信息:正在执行用户自定义config文件:${global:用户config文件路径} "
}
else
{
Write-Error "info: executing user custom config file: ${global:用户config文件路径} "
}
& $global:用户config文件路径
}
else
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Verbose "错误:找不到用户自定义config文件路径:${global:用户config文件路径} "
}
else
{
Write-Verbose "Error: user custom config file path not found: ${global:用户config文件路径} "
}
}
}
exit 0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/ryouj/kasini3000.git
[email protected]:ryouj/kasini3000.git
ryouj
kasini3000
kasini3000
master

搜索帮助