Need to run a command during deployment which persists after the agent is done

16 views
Skip to first unread message

Tsanko Stoev

unread,
Jun 16, 2023, 1:18:28 PM6/16/23
to go...@googlegroups.com
Hello All,

I wanted to see if there is a way to solve an issue we are having today. We have a deployment that runs several commands. At the end of the deployment we run a command that starts a service. We noticed that the command is launched as a subprocess of the agent connection, which results in that subprocess being killed once the agent is done deploying. Is there a way to run a job command that persists after the deployment is done. 
I hope my explanation made sense. 
Thanks.

Sincerely,
Tsanko Stoev


Ketan Padegaonkar

unread,
Jun 16, 2023, 3:29:00 PM6/16/23
to go...@googlegroups.com
Assuming you're on linux: you want to spawn a new process group while background your command. Check the setsid command in bash. This will contain some useful examples: https://stackoverflow.com/questions/19233529/run-bash-script-as-daemon

- Ketan



--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAGWsXCDU57CNqbkiJ8vimsdaxRPXssFHbf6jjPEC_55j7_LnJA%40mail.gmail.com.

Ashwanth Kumar

unread,
Jun 16, 2023, 3:59:06 PM6/16/23
to go...@googlegroups.com
May be use systemd or supervisord or monit to start your process? 



Reply all
Reply to author
Forward
0 new messages