bash 找不到bash重启命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27452790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:47:00  来源:igfitidea点击:

bash reboot command not found

bashshell

提问by tech_human

I am trying to execute a script on server. When I do crontab -lI get @reboot cd my_project_path; ./start.shon terminal.

我正在尝试在服务器上执行脚本。当我这样做时,crontab -l我会@reboot cd my_project_path; ./start.sh进入终端。

However when I do @reboot cd my_project_path; ./start.shI get -bash: @reboot: command not found. How do I include reboot command in bash? Sorry if this is a very basic question, but I am not master in bash.

但是,当我这样做时,@reboot cd my_project_path; ./start.sh我得到-bash: @reboot: command not found. 如何在 bash 中包含重启命令?对不起,如果这是一个非常基本的问题,但我不是 bash 大师。

回答by Elliott Frisch

There isn't a command @reboot. I think you're looking for

没有命令@reboot。我想你正在寻找

shutdown -r now

or (possibly)

或(可能)

/sbin/reboot

which will reboot your machine. However, in crontaba @reboot is a scheduled time, so that's the command it would run when your system has just rebooted... so perhaps you really just wanted

这将重新启动您的机器。但是,在crontab@reboot 中是预定时间,因此这是系统刚刚重新启动时它会运行的命令......所以也许你真的只是想要

cd my_project_path; ./start.sh

回答by DimiDak

@rebootin crontab means "Do that / execute that on server boot"

crontab 中的@reboot表示“在服务器启动时执行此操作”