【发布时间】:2013-05-25 06:32:29
【问题描述】:
我试图弄清楚如何在启动时运行命令,就像我将它输入控制台一样。我在我的 Raspberry Pi 上使用 Rasbian,但我认为这个问题对于 Debian 来说是一样的。我要运行的命令是:
sudo screen mono server.exe
我尝试了以下解决方案,但由于我刚开始使用Linux,我不确定这是否正确。
#! /bin/sh
# /etc/init.d/server
### BEGIN INIT INFO
# Provides: server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple script to start a program at boot
# Description: ..
### END INIT INFO
# If you want a command to always run, put it here
sudo screen mono server.exe
exit 0
【问题讨论】:
-
您尝试运行的命令实际上是三个单独的命令; 1.“sudo”以超级用户身份运行下一个命令。 2. “screen”是终端多路复用器,然后是 3. “mono server.exe”,如果我们根据文件名判断,它是调用可执行文件的运行时。如果没有更多信息,很难知道为什么它不能工作。
标签: command debian raspberry-pi startup boot