可能重复:
如何在启动时运行shell脚本(启动)
我有.sh脚本来运行我的游戏服务器与单声道。 我需要在启动时运行这个命令
sh script.sh start
怎么样?
把它放到/etc/rc.local :
#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. sh /path/to/script.sh start
或者在具有特殊激活参数的cron作业中:
crontab -e @reboot /path/to/script.sh start