How to run sh script automatically when booting

  1. How to automatically run a sh script on boot in linux.
    For example , the second question is to automatically run /test.sh at boot . Is there any way to make sure that test.sh has run correctly?
  2. To start running, just add it to rc.local, usually /etc/rc.d/rc.local and add the following line to it:
  3. sh /path/to/test.sh
  4. Use the linux global variable $? to determine whether to execute, such as
    if [$? eq 0]
        then

  5.                 echo "succeed!"

        be

#modified some typo --update @22:48

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326138409&siteId=291194637