-3

I have lot of questions about scripts. How to configure the script that 1 It automatically turns on when the computer is turned on? 2 I was possible start and close the script with console? 3 After closing console the script still have been work?

1 Answers1

1
  1. That's depend on what OS you are running. A program that starts when a computer is turned on is generally called a service. Traditional Unix way is to use rc script. If you used systemd, that should still be supported. See How does systemd use /etc/init.d scripts?

  2. All scripts can be started from the console by design, just use their full path or have their directory in your path and use their name. Stopping a script can be done using CtrlC if running in the foreground, or ps and kill interactively from another script, or better, pkill when available. Depending on the signal and the script, it can be terminated gracefully or not.

  3. A script launched with nohup and running in the background is unaffected when the console from where it was launched is closed.

jlliagre
  • 61,204