4

我在“登录项”首选项中注册了以下 shell 脚本,但它似乎没有任何效果。它旨在启动 moinmoin wiki,但仅在从终端窗口手动运行时才有效,之后它会一直运行直到机器下一次关闭。

#!/bin/bash
cd /Users/stuartcw/Documents/Wiki/moin-1.7.2
/usr/bin/python wikiserver.py >> logs/`date +"%d%b%Y"`.log 2>&1 &

我真的希望 Wiki 在重新启动后可用,因此在理解这一点方面的任何帮助将不胜感激。

4

4 回答 4

4

尝试使用启动。更多信息请访问http://www.macgeekery.com/tips/all_about_launchd_items_and_how_to_make_one_yourself

于 2008-12-03T00:26:49.030 回答
4

launchd 是 MacOS X 最好的部分之一,在其他系统上找不到它让我非常痛苦。

编辑并将其放置/Library/LaunchDaemonscom.you.wiki.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.you.wiki</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>RunAtLoad</key>
    <true/>
    <key>Nice</key>
    <integer>1</integer>
    <key>WorkingDirectory</key>
    <string>/Users/stuartcw/Documents/Wiki/moin-1.7.2</string> 
    <key>UserName</key>
    <string>user to run this as</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/python</string>
        <string>wikiserver.py</string>
    </array>
</dict>
</plist>
于 2008-12-03T04:46:19.193 回答
3

一些有用的链接:

Mac OS X:创建登录挂钩

使 Shell 脚本在登录或系统启动时启动

如果您决定改用 Launchd,另请参阅Lingon了解前端。

于 2008-12-03T00:36:56.950 回答
1

我不太了解它,因为我不使用登录项。只是一个建议,也许可以尝试使用调用这些 shell 命令的 applescript,并将其放在登录项中。

于 2008-12-03T00:25:51.327 回答