我正在运行mongo 1.8.2并试图看看如何在Mac上干净利落地关闭它.
在我们的ubuntu服务器上,我可以从mongo shell干净地关闭mongo:
> use admin
> db.shutdownServer()
Run Code Online (Sandbox Code Playgroud)
但在我的Mac上,它并没有杀死mongod进程.输出显示它'应该'关闭但是当我ps -ef |时 grep mongo它向我展示了一个活跃的过程.另外,我仍然可以打开一个mongo shell并查询我的dbs,就像它从未关闭一样.
我的db.shutdownServer()本地输出是:
MongoDB shell version: 1.8.2
connecting to: test
> use admin
switched to db admin
> db.shutdownServer()
Tue Dec 13 11:44:21 DBClientCursor::init call() failed
Tue Dec 13 11:44:21 query failed : admin.$cmd { shutdown: 1.0 } to: 127.0.0.1
server should be down...
Tue Dec 13 11:44:21 trying reconnect to 127.0.0.1
Tue Dec 13 11:44:21 reconnect 127.0.0.1 failed couldn't connect to server 127.0.0.1
Tue Dec 13 …Run Code Online (Sandbox Code Playgroud) 我正在尝试改进iOS的Hudson CI,并在系统启动后立即启动Hudson.为此,我使用以下launchd脚本:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>Hudson CI</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-jar</string>
<string>/Users/user/Hudson/hudson.war</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>user</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
这工作正常,但是当由Hudson启动的xcodebuild尝试签署应用程序时,它失败了,因为它无法在钥匙串中找到正确的密钥/证书.但是密钥/证书对是存在的,因为如果我从命令行启动Hudson它正常工作.
你知道为什么会这样吗?
我已经安装了postgresqlvia HomeBrew.它工作但今天我发现postgresql计算机启动时服务器不运行.
我尝试使用launchctl以下命令再次加载它:
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Run Code Online (Sandbox Code Playgroud)
我看到了这样的信息:
/usr/local/Cellar/postgresql/9.3.4/homebrew.mxcl.postgresql.plist: Service is disabled
Run Code Online (Sandbox Code Playgroud)
我不知道如何启用postgresql服务.有人能告诉我吗?
我想在登录时运行在后台运行的同步同步服务.但我的代理人的状态代码是78.我不知道为什么,我尝试了在线发布的一些修复,但它只是不起作用.
有什么问题??下面是我服务的plist文件.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>syncmyproject</string>
<key>StandardOutPath</key>
<string>/var/log/syncmyproject.log</string>
<key>StandardErrorPath</key>
<string>/var/log/syncmyproject.log</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Debug</key>
<true/>
<key>EnableGlobbing</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/unison</string>
<string>-auto</string>
<string>-batch</string>
<string>-repeat watch</string>
<string>~/home/project</string>
<string>~/project</string>
</array>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud) 我最近使用Homebrew安装了Jenkins.我还使用Homebrew安装了Mercurial.
我可以成功克隆一个hg仓库 - 从终端.但如果我尝试在詹金斯的工作中做同样的事情,那就失败了.
所以,在工作中,我告诉Jenkins运行一个shell脚本echo $PATH.果然,路径/usr/local/bin不存在.如果我从终端执行相同的命令,它就在那里.
那么,什么是修改PATH的最佳方法,以便当我从终端回显时,Jenkins正在拉动我正在使用的相同PATH?
注意,Jenkins是从我登录进行这些测试的同一个用户帐户运行的,所以我无法理解为什么会发生这种情况.
我的程序耗尽了内存,就像我运行它们的时间的一半.在Linux下,我可以使用ulimit -v mem-in-kbytes设置可用内存的硬限制.实际上,我使用ulimit -S -v mem-in-kbytes,所以我在程序中得到了正确的内存分配问题,我可以中止.
但是...... ulimit在OSX 10.6中不起作用.我尝试过使用-s和-m选项,但它们无法正常工作.
在2008年,MacRumors对同一个问题进行了一些讨论,但没有人提出一个好的选择.应该是一个程序可以学习它花费太多内存或通过操作系统设置限制的方式.
我试图找出我的启动脚本无法正常工作的原因.这非常简单,但我是mac环境的新手,并试图习惯.这是我的plist.我知道ProgramArguments是必需的,所以我只是将脚本路径放在那里.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.tomcat.plist</string>
<key>ProgramArguments</key>
<array>
<string>/opt/apache-tomcat-5.5.27/bin/startup.sh</string>
</array>
<key>OnDemand</key>
<false/>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
当我尝试运行launchctl load <name>它似乎正确加载(因为它不会给我任何错误消息),但脚本似乎没有执行,即使在重新启动时.
我已经使用了我在网上找到的所有示例,但我无法弄清楚为什么在启动时没有运行我的脚本.
我们在使用SMJobBless更新帮助工具时遇到了问题,这个工具一直困扰着我们好几天.
我们正在开发一个应用程序,在某些时候我们需要执行管理任务(加载/卸载kext).我们还使用钥匙串存储我们的应用程序的帐户信息.
对于管理任务,我们使用一个使用SMJobBless安装的辅助工具,我们使用DO over Mach端口(使用NSConnection)与之交流.
在帮助工具中:
// use our bundle id as our service name
NSString* name = [[NSBundle mainBundle] bundleIdentifier];
launch_data_t checkinRequest = launch_data_new_string(LAUNCH_KEY_CHECKIN);
launch_data_t checkinResponse = launch_msg(checkinRequest);
launch_data_t machServicesDict = launch_data_dict_lookup(checkinResponse, LAUNCH_JOBKEY_MACHSERVICES);
launch_data_t machPort = launch_data_dict_lookup(machServicesDict, [name UTF8String]);
mach_port_t mp = launch_data_get_machport(machPort);
launch_data_free(checkinResponse);
launch_data_free(checkinRequest);
NSMachPort *receivePort = [[NSMachPort alloc] initWithMachPort:mp];
NSConnection *server = [NSConnection connectionWithReceivePort:receivePort sendPort:nil];
Run Code Online (Sandbox Code Playgroud)
在应用程序中:
NSConnection *conn = [NSConnection connectionWithRegisteredName:HELPER_BUNDLE_IDENTIFIER host:nil];
id proxyServerObject = [conn rootProxy];
if(conn && proxyServerObject) {
return [proxyServerObject someMethod];
} …Run Code Online (Sandbox Code Playgroud) 我将launchd配置为每天晚上18点在我的mac pro上启动命令,但它无法正常工作.
我想检查一下launchd是否运行了该命令.我试过系统控制台,没有找到任何有价值的东西.
我的mac os版本是mac os x 10.8.3
我的plist文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mytask</string>
<key>Program</key>
<string>/opt/local/bin/node</string>
<key>ProgramArguments</key>
<array>
<string>/Users/xxx/My/task.js</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>18</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>StandardOutPath</key>
<string>/Users/xxx/launchd.stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/xxx/launchd.stderr.log</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud) 我有一些自制的启动脚本.但是,当我重新启动计算机时,我必须手动运行它们:
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
Run Code Online (Sandbox Code Playgroud)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/Users/dash/.local/Cellar/mysql/5.1.49/bin/mysqld_safe</string>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>dash</string>
<key>WorkingDirectory</key>
<string>/Users/dash/.local/var</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
我认为这应该在启动时发生.我错过了什么?
launchd ×10
macos ×7
jenkins ×2
code-signing ×1
homebrew ×1
hudson ×1
ios ×1
keychain ×1
launch-agent ×1
memory ×1
mongodb ×1
objective-c ×1
osx-lion ×1
postgresql ×1
service ×1
ulimit ×1
virtual ×1