简体   繁体   中英

How to run a shell script at startup

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

multi ways to finish it :

  1. crontab
  2. rc.local
  3. init.d
  4. systemd

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

On an Amazon S3 Linux instance, I have two scripts called start_my_app and stop_my_app which start and stop forever (which in turn runs my Node.js application). I use these scripts to manually start and stop my Node.js application. So far so good.

My problem: I also want to set it up such that start_my_app is run whenever the system boots up. I know that I need to add a file inside init.d and I know how to symlink it to the proper directory within rc.d , but I can't figure out what actually needs to go inside the file that I place in init.d . I'm thinking it should be just one line, like, start_my_app , but that hasn't been working for me.

if you want to put startup also you can use

first of all move your script /etc/init.d then chmod 777 /etc/init.d/your script name

after apply following command

update-rc.d your script defaults remove update-rc.d -f your script remove

at the startup you can see your app will run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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