如何设置终端脚本在Mac OS X Snow Leopard上启动时运行? [英] How do I set Terminal scripts to run at start up on Mac OS X Snow Leopard?

查看:67
本文介绍了如何设置终端脚本在Mac OS X Snow Leopard上启动时运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用Mac OS X 10.6.8.如何设置一些简单的Terminal命令以在启动时运行,就像我打开Terminal并将这些命令放到自己一样?我基本上需要在启动时启动一些服务器守护程序.我在终端中使用的手动启动命令的命令看起来像sudo ruby myrubyserverscript_control.rb start.如果这太明显了,或者已经以某种我不了解的方式在这里回答了一百万遍,我会为此道歉.

Hello I'm using Mac OS X 10.6.8. How can I set some simple Terminal commands to run on start up as if I was opening up Terminal and putting those commands in myself? I basically need to start a few server daemons on start up. The commands I use in Terminal to manually start them look like sudo ruby myrubyserverscript_control.rb start. I apologize in advance if this is super obvious or already answered on here a million times in some way I don't know enough to recognize.

推荐答案

这是两件事:

  1. 您要在系统启动(引导)后运行脚本,或者
  2. 登录时

要在启动时运行脚本,您应该将一个XML配置文件放入/Library/LaunchDaemons中(launchd进程将在启动时运行脚本)

for run a script at boot, you should put one XML config file into /Library/LaunchDaemons (and the launchd process will run the script at the boot time)

用于登录后运行脚本-参见: https://stackoverflow.com/a/6445525/632407

这篇关于如何设置终端脚本在Mac OS X Snow Leopard上启动时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆