Processes started in terminal end when terminal closed

justinfra

Registered
Like the title says.

I'm running Symantec Backup Agent on our mac osx server. I start the agent in the terminal (./agent.be). It returns a notification that it started the service, however, it doesn't return to the prompt. Closing the terminal gives a warning that the process will be closed if the terminal is closed. Closing it does kill the process. Ctrl+c to return to the prompt also kills the process. So it's as if once the process is started in the terminal, nothing can be altered.

I am not much of a mac guy so please forgive me if this is a stupid question.

Anyone have any advice on how to handle this so the process is ALWAYS running?
 
To get the job to run in the background (and return a prompt) do:

./agent.be &

Now if you quit the terminal the process should stay running. You can verify by opening a new terminal and:

ps -ax | grep agent.be

As to having it run automatically at boot time, did you try rebooting the server after installation? The Q&A on this site seem to suggest that (see questions 3,4,5).
 
Even a background command will be killed sometimes when the shell is closed. Instead, use the 'screen' command. that'll open a virtual window.

Type screen at a command prompt to open a virtual session. Run your program, then press Control-A, then Control-D to break away from the screen. To resume the screen, open another terminal window and type screen -r and you'll be reconnected.

Todd
 
Back
Top