我试图找出如何在启动时运行命令,就像我将其键入控制台一样.我在Raspberry Pi中使用Rasbian,但我认为这个问题对于Debian来说是一样的.我正在尝试运行的命令是:
sudo screen mono server.exe
Run Code Online (Sandbox Code Playgroud)
我尝试了以下解决方案,但由于我刚开始使用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
Run Code Online (Sandbox Code Playgroud)