Reputation: 965
i'll need some help to get back the prompt, right now i'm executing this block and don't throw me back the prompt, i'm using &
at the end for run this command as a background task. how can get back to prompt after execute the script.
#!/bin/sh
sudo su - user << EOF
nohup program -p4xxx &
EOF
nota: if i press ctrl + c - kill the program.
Thank you in advance.
Upvotes: 2
Views: 6538
Reputation: 246774
Without testing, I'm wondering if you want this:
#!/bin/bash
nohup sudo -u user program -p4xxx &
disown
That will background the sudo process, and disassociate it from the calling shell (the script).
Upvotes: 3
Reputation: 7225
Two alternative:
fg
and send signal with
ctrl+c
program
job)
with pkill program
Upvotes: 0
Reputation: 2764
(From https://askubuntu.com/questions/121559)
After you start a process (job), you can still do other things. You might want to write these down as a cheat sheet.
You can also type bg or fg with a number after, like fg 3. This will bring job #3 to the foreground.
Upvotes: 2