Run the bash script from another script and exit the script first, and in the second -

First bash script:

./second #takes too long

I want to kill the bash script first, and the second bash script is still running.

Can I do it?

UPDATE

The script first runs cronjob!

+4
source share
2 answers

If the last thing the first script does is call the second script, then do the following:

exec ./second

which replaces the first script process with the second.

otherwise

nohup ./second &
disown
+4
source

For Linux, you should use the kill command after receiving the PID of the program you want to exit -

http://linux.about.com/library/cmd/blcmdl_kill.htm

I do not know how you could get the PID automatically through a script.

, "pkill" -

Ex -

pkill -9 ping

killall -

killall firefox

https://www.digitalocean.com/community/tutorials/how-to-use-ps-kill-and-nice-to-manage-processes-in-linux

BATCH, bash. .

, PID. -

taskkill /f /im "x"

"x" - , , .

, -

/im ImageName: , . (*), .

/f: , . ; .

- http://technet.microsoft.com/en-us/library/bb491009.aspx

+1

Source: https://habr.com/ru/post/1568810/


All Articles