Articles of shell

Exchange 2010获取邮箱统计信息访问被拒绝

我为用户维护创build了一个脚本,我想用一个名为'new_user'的新用户来运行它,只需要权限: Get-MailboxStatistics mailboxtest 当我尝试从PowerShell直接运行它时,出现以下错误: Get-MailboxStatistics:无法在对象“EXCHDB0201”上提交更改,因为访问被拒绝。 在行:1 char:22 + Get-MailboxStatistics <<<< mailboxtest + CategoryInfo:NotSpecified:(0:Int32)[Get-MailboxStatistics],MapiAccessDeniedException + FullyQualifiedErrorId:55409F96,Microsoft.Exchange.Management.MapiTasks .GetMailboxStatistics 我已阅读此TechNetpost中有关此错误,但不是一个任务计划程序问题。 在我的电脑上使用'new_user'login我得到同样的错误。 我还创build了一个新的pipe理angular色,添加了所有angular色,并为这个新angular色添加了'new_user',但仍然存在错误。 我还有什么要做的? 任何想法?

CentOS VPS突然冻结,无法正常启动

在我的VPS上,一旦临时目录已满并且服务器被冻结。 重新启动后,我删除/ temp中的文件,一小时后,服务器再也没有在ssh中响应。 它重新启动,现在当服务器启动时,我只能在控制台中看到这个 。 SSH和SFTP现在不工作。 你知道这是什么,如何恢复正常的function? 编辑:错字和语法更正

使用crontab调度屏幕命令

我遇到了一个问题 ,我最终帮忙的脚本是通过ssh执行一个mysqldump到Windows机器,当从cron调用时,文件变为空白。 经过大量的调查,我发现这是一个错误,提出的解决方法是使用script命令来捕获输出。 不幸的是,当通过cron调度script命令本身似乎performance出稍微不同的行为。 如果我写这样一个bash脚本: rm script.log script -q -c "ssh user@host -p portnum \"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe\" –login-path=local –routines –single-transaction db_name" script.log > /dev/null ls -lh script.log 使用screen命令和ssh执行一个mysqldump,然后执行该文件的ls -lh 。 如果我自己运行这个脚本,我可以像预期的那样看到文件N MB很大。 如果我通过cron调用这个脚本,脚本运行的时候最终会变成零字节,但是如果我自己马上就可以看到它现在又变成NMB了 – 这就好像屏幕的分叉行为有不同的performance在一个ttyless cron下,当脚本结束时,屏幕命令仍然运行,如果通过cron运行,但是屏幕命令在交互运行时在ls之前结束。 有没有人了解发生了什么比我有什么build议如何防止或周围的工作?

Logron问题在crontab中

在使用logtail时出错。 不使用crontab。 而且,当脚本正常运行时,读取整个文件而不是附加一个文件。 请举例说明如何使用它。 在脚本文件中使用这个 logtail -f $ file | egrep -nr $ ERRORSTRING> $ FILTERERRORLOC

在Powershell GetDrive函数不起作用

下面是示例代码不能在PowerShell中工作 这里$rpath就像共享驱动器\\xyz\share $fso = new-Object -com Scripting.FileSystemObject $drivename = $fso.GetDriveName($rpath) $drive= $fso.GetDrive($drivename) 我得到以下错误 使用“1”参数调用“GetDrive”exception:“HRESULTexception:0x8 00A004C(CTL_E_PATHNOTFOUND)”

Jenkins执行shell返回值命令vs文件

我在Jenkins中使用了Execute shell函数和一组不同的命令(调用newmantesting应用程序)。 当其中一个testing用例失败时,我的构build被标记为失败。 上一个Execute shell newman run ./test/postman_collection_1.json –environment ./test/postman_environment.json –bail newman run ./test/postman_collection_2.json –environment ./test/postman_environment.json –bail 由于我移动了所有这些命令到一个脚本文件,并使用“Execute shell”来执行这个脚本文件(这是以前直接在“Execute shell”中的命令的副本),当我的构build不再被标记为失败其中一个newmantesting用例失败。 新buildExecute shell : chmod +x ./docs/ci_tests.sh ./docs/ci_tests.sh ci_tests.sh内容: #!/bin/bash newman run ./test/postman_collection_1.json –environment ./test/postman_environment.json –bail newman run ./test/postman_collection_2.json –environment ./test/postman_environment.json –bail 为什么当我通过文件使用它们时,命令的返回值( newman )没有触发jenkins失败的任何原因?

CentOS – bash版本在升级后不会改变

目前的bash版本容易受到shellshock的攻击。 但升级不会改变bash。 我试过重新启动。 CentOS版本5.6 [user@server ~]$ bash –version GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. [user@server ~]$ yum list bash Loaded plugins: fastestmirror base/primary | 1.2 MB 00:00 base 3566/3566 Installed Packages bash.x86_64 3.2-32.el5 installed

apache2将httpredirect到httpsstream浪箱中

我试图实现apache2 httpredirect到httpsstream浪。 下面是我的Vagrantfile和bootstrap.sh脚本。 在无家可归的情况下,我无法弄清楚我在这里做错了什么。 我正在使用Ubuntu 16.04stream浪汉形象。 VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/xenial64" config.vm.hostname = "suffire" config.vm.network :forwarded_port, guest: 80, host: 8080, protocol: "tcp" config.vm.network :forwarded_port, guest: 443, host: 8443, protocol: "tcp" config.vm.network :private_network, ip: "10.0.1.10" config.vm.provision :shell, path: "bootstrap.sh" end Bootstrap脚本如下。 #!/usr/bin/env bash # ————————————— # Virtual Machine Setup # ————————————— # […]

退出使用nc或ncat进行ldaptesting的代码

我正在尝试编写shell脚本来testing服务器是否能够达到指定的IP和端口。 我正在使用的命令: ncat -w 5 <IP> 636 or 389 > /dev/null 2>&1 < /dev/null | echo $? ncat -w 5 <IP> 636 or 389 > /dev/null 2>&1 < /dev/null | echo $? 问题是当我检查上述两个端口的退出码我收到1。 当我运行它没有/ dev / null我得到一个连接到IP。 ncat -v -w 5 <IP> 636 Ncat: Version 6.40 ( http://nmap.org/ncat ) Ncat: Connected to <IP>:636. ^C 问题是如果我使用第二个命令没有/ […]

如何在n秒后创build并closuresSOCKS5隧道?

我正在通过ssh创buildSOCKS 5隧道: ssh -D 1337 -f -C -c blowfish -q -N user@host 我只需要一个快速和松散的客户端连接,然后不再需要它。 我希望它自动激活x秒后closures。 我试过postfixing sleep 10 ,这将甚至可能保持打开,直到连接的客户端断开连接,但10秒后closures。 当我运行这个: ssh -D 1337 -f -C -c blowfish -q -N user@host sleep 10隧道从不closures。 我可以在bash脚本中睡10,然后find这个过程并杀死它,但是我觉得它可能比这更简单。