normal用户同一时间只能有一个登录session,如何实现多个登录?
声明:本博客只代表作者本人,不代表作者所在公司和组织等。如因此采用本博客内容造成的损失和不便,本博客概不负责。如需相应service请联系对应厂商
1,下载client

2,编写脚本
脚本A(foreverToken.pl)
-----------------
#!/usr/bin/perl -w
use BuildForge::Services;
$conn = new BuildForge::Services::Connection("localhost");
$token = $conn->authUser("yq","qq");
print "token: $token
";
#$conn->authToken($token);
# Getting existing projects
$project = BuildForge::Services::DBO::Project->findByName($conn, "proj1");
# Getter / setter functions
$id = $project->getProjectId();
$name = $project->getName();
$class = $project->getBuildClass();
$env = $project->getEnvironmentId();
print "Name: $name
";
print "ID: $id
";
print "Class: $class
";
print "Env ID: $env
";
#wait for a very long, the other script can use the same session.
my $verbose = 99999999;
my $idx = 0;
while ($idx<$verbose) {
sleep 20;
$idx =$idx+1;
warn "index: $idx
";
}
$conn->logout;
$conn->close;
脚本B(shareToken.pl)
-------------------------
#!/usr/bin/perl -w
use BuildForge::Services;
$conn = new BuildForge::Services::Connection("localhost");
#$token = $conn->authUser("yq","qq");
#get the token after the scriptA is executed
$conn->authToken("77baef380c571000ca2b83f44d314d31");
# Getting existing projects
$project = BuildForge::Services::DBO::Project->findByName($conn, "proj2share");
# Getter / setter functions
$id = $project->getProjectId();
$name = $project->getName();
$class = $project->getBuildClass();
$env = $project->getEnvironmentId();
print "Name: $name
";
print "ID: $id
";
print "Class: $class
";
print "Env ID: $env
";
#don"t logout or close, for myabe other scripts are using this session at the same time
print "exit";
3, 执行脚本
如图1所示的目录结构
perl -I "c:\autofvt bf-serviceslib" foreverToken.pl
得到输出token,后修改shareToken.pl,然后在新的cmd窗口执行shareToken.pl
perl -I "c:\autofvt bf-serviceslib" shareToken.pl
- 上一篇:没有了
- 下一篇: DB2CODEPAGE=1208 如果BuildForge登录的页面显示乱码如何处理
