13
5
I have a couple of commands that I need to run. These commands needs to continually run even after I exit my interface. When I have access to the Linux GUI, I execute something like:
cd /home/testuser/Scripts*
xterm -hold -T "Background_Script1" -e "service1-start.sh" &
sleep 10
xterm -hold -T "Background_Script2" -e "service2-start.sh" &
Any help will be much appreciated.
2
Possible duplicates questions: http://superuser.com/questions/581963/how-can-i-use-nohup-if-the-shell-script-taking-more-time-to-run http://superuser.com/questions/644537/bash-processes-reattach-process-started-in-background http://superuser.com/questions/488434/running-linux-commands-in-the-background-ampersand-or-screen
– Hennes – 2014-11-18T11:01:54.857Is there any reason why you're not running these services as daemons? – SevenSidedDie – 2014-11-18T21:16:16.253
Are the commands meant to be services that should run at near-100% uptime "forever", or a long-running processing task that's expected to finish after some time? All answers will "work" for both cases, but the proper recommendation will be different. – Peteris – 2014-11-19T17:13:47.277
Which specific distribution of Linux are you using? I found that running
set -m;
makes it so that my scripts continue running after I log out on CentOS and RHEL. – ArtOfWarfare – 2014-11-19T20:09:32.987