1

When i run this script via terminal on my dedicated server it works. But only while the window is opened (the terminal). When i close the window, it close the script for running. How can i make it running forever in the background?

#!/bin/bash ./robots.sh & ./update_robots.sh & ./update_auctions_end.sh & ./auto_bidders.sh

  • Put `&` at the end when running the script – Andrea May 20 '16 at 18:04
  • 7
    See: [How to make a programme continue to run after log out from ssh?](http://stackoverflow.com/q/954302/3776858) or [Linux: Prevent a background process from being stopped after closing SSH client](http://stackoverflow.com/q/285015/3776858) and [What's the difference between nohup and ampersand](http://stackoverflow.com/q/15595374/3776858) – Cyrus May 20 '16 at 18:04

2 Answers2

0

You will want to use the "nohup" command to do something like this:

nohup ./robots.sh > /dev/null 2>&1 &

Hope this helps you.

You can see full details of nohup here: http://linux.die.net/man/1/nohup

JustLloyd
  • 129
  • 2
  • 8
  • Like this? #!/bin/bash nohup ./robots.sh > /dev/null 2>&1 & nohup ./update_robots.sh > /dev/null 2>&1 & nohup ./update_auctions_end.sh > /dev/null 2>&1 & nohup ./auto_bidders.sh & – Jesper Kampmann May 20 '16 at 19:33
0

try sending output to null, then your command window will not wait for output and will leave the process alone with itself:

command params > /dev/null 2>/dev/null &
Ali Farhoudi
  • 5,350
  • 7
  • 26
  • 44