简体   繁体   English

如何在初始化脚本中执行lua文件?

[英]How can I execute the lua file in init script?

I have a problem in init script. 我的初始化脚本有问题。

reload_service() {
    echo "####################### restart##################" > /dev/ttyS0
    lua /root/proto.lua
    lua /root/ft.lua
    /etc/init.d/network reload
}

From that code, everything is fine, but I can't see the result of the two lua files(In those files, I put the print function. When i typed the lua command in command line, I can see the print function's result). 从该代码中,一切都很好,但是我看不到两个lua文件的结果(在那些文件中,我放置了打印功能。当我在命令行中键入lua命令时,我可以看到打印功能的结果) 。 In init script, can i use the lua command? 在初始化脚本中,我可以使用lua命令吗?

You can use syslog for logging, print statement wont be visible in console. 您可以使用syslog进行日志记录,在控制台中不会显示print语句。 Or in place of print dump the logs in some file. 或者代替打印将日志转储到某个文件中。

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

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