设置开机自启动脚本,失败了无数次,应该要怎么操作呢?
按照这个网址,https://www.jb51.cc/ubuntu/606293.html,服务启动成功了,查看test.log日志有内容输出。
在/etc/rc.local文件里加入自己的脚本文件,怎么都启动不了,/etc/rc.local内容如下:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo "看到这行字,说明添加自启动脚本成功。" > /usr/local/test.log
su - HwHiAiUser
cd /home/HwHiAiUser/
bash main.sh
exit 0
我的main.sh脚本在/home/HwHiAiUser/ 目录下,在该目录下手动执行bash main.sh ,程序启动成功。main.sh内容如下:
#!/bin/bash
cd /home/HwHiAiUser/samples/cplusplus/level3_application/1_cv/detect_and_grab_16out/out/
./main
问题出在哪,怎么样才能成功自启动main脚本?
设置开机自启动脚本,失败了无数次,应该要怎么操作呢?
按照这个网址,https://www.jb51.cc/ubuntu/606293.html,服务启动成功了,查看test.log日志有内容输出。
在/etc/rc.local文件里加入自己的脚本文件,怎么都启动不了,/etc/rc.local内容如下:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo "看到这行字,说明添加自启动脚本成功。" > /usr/local/test.log
su - HwHiAiUser
cd /home/HwHiAiUser/
bash main.sh
exit 0
我的main.sh脚本在/home/HwHiAiUser/ 目录下,在该目录下手动执行bash main.sh ,程序启动成功。main.sh内容如下:
#!/bin/bash
cd /home/HwHiAiUser/samples/cplusplus/level3_application/1_cv/detect_and_grab_16out/out/
./main
问题出在哪,怎么样才能成功自启动main脚本?