我写了一个简单的 bash 脚本:
#!/bin/bash
echo "hi" > log
exit 0
Run Code Online (Sandbox Code Playgroud)
使其可执行并成功运行。我将 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.
/home/katph/test.sh
exit 0
Run Code Online (Sandbox Code Playgroud)
rc.local 是可执行的:
/$ ls …Run Code Online (Sandbox Code Playgroud)