简体   繁体   English

linux在启动centos时运行脚本

[英]linux run script at startup centos

i have nodejs App i want run script at startup centos 我有nodejs应用,我想在启动中心运行脚本

my script.sh is 我的script.sh是

#!/bin/bash
cd /home/mb/Desktop/Voip
gulp

my Executing Commands and Scripts at Reboot & Startup in Centos 7 is 我在Centos 7中的“重新启动和启动”时的执行命令和脚本是

crontab -e

@reboot sh /home/mb/Desktop/script.sh

does not work 不起作用

The simplest way is to edit /etc/rc.local : 最简单的方法是编辑/etc/rc.local

/bin/sh /home/mb/Desktop/script.sh &

or try to debug your cron : 或尝试调试您的cron:

crontab -e

@reboot /bin/sh /home/mb/Desktop/script.sh &>/tmp/debug

Then, cat /tmp/debug 然后, cat /tmp/debug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM