我想弄清楚如何在启动时运行一个命令,就像我将它输入到控制台。我在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.作为终端多路复用器的“屏幕”,然后是3.“mono server.exe”,如果我们通过文件名来判断,它是一个运行时调用可执行文件。很难知道为什么没有更多的信息它不工作。 – jeremiah