You are not logged in.

#1 2021-03-19 16:06:38

Xwang
Member
Registered: 2012-05-14
Posts: 353

[Solved] Script that calls long lasting commands every hour

Hi to all,
I would like to create a script that once executed launches long lasting commands (every one lasts about 2 hours) and I would like to be able to terminate the main script without killing the commands which are already running.
Doing something like this:

 #!/bin/bash
 
while true; do 
    longLastingCommand.sh &
    sleep 3600; 
done

permit me to call the longLastingCommand.sh every hour, but when I use ctrl+c to close the script, all the istances of longLastingCommand still running are immediately killed.
Can you help me please?

Last edited by Xwang (2021-03-20 08:52:09)


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

#2 2021-03-19 16:25:16

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: [Solved] Script that calls long lasting commands every hour

Offline

#3 2021-03-20 08:51:53

Xwang
Member
Registered: 2012-05-14
Posts: 353

Re: [Solved] Script that calls long lasting commands every hour

Morn wrote:

Using

nohup [command] &

is the solution.
Thank you for your help very much!
Xwang


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

Board footer

Powered by FluxBB