It is currently Sun May 20, 2018 3:15 pm

cannot exit terminal with user privileges after script

All times are UTC - 6 hours

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Sun Aug 05, 2012 12:23 pm   

Joined: Fri Aug 03, 2012 2:07 pm
Posts: 20
Please can anyone help explain what this means?
When I entered the command exit on my user terminal, I got the following report:
$ exit
There are no stopped jobs.

I then ran the jobs command. It gave me this listing.
[1] Stopped ./bells
[2] Stopped ./bells
[3] Stopped ./bells
[4] Stopped ./bells
[5] Stopped ./bells
[6] Stopped ./bells
[7] Stopped ./bells
[8] Stopped ./bells_copy
[9]- Stopped ./bells_copy
[10]+ Stopped ./bells_copy

And when I ran the ps command I received this other listing.
1950 pts/1 00:00:00 bash
2110 pts/1 00:00:00 bells
2111 pts/1 00:00:00 timeout <defunct>
2113 pts/1 00:00:00 bells
2114 pts/1 00:00:00 timeout <defunct>
2143 pts/1 00:00:00 bells
2144 pts/1 00:00:00 timeout <defunct>
2186 pts/1 00:00:00 bells
2187 pts/1 00:00:00 timeout <defunct>
2193 pts/1 00:00:00 bells
2194 pts/1 00:00:00 timeout <defunct>
2208 pts/1 00:00:00 bells
2209 pts/1 00:00:00 timeout <defunct>
2214 pts/1 00:00:00 bells
2215 pts/1 00:00:00 timeout <defunct>
10947 pts/1 00:00:00 bells_copy
10951 pts/1 00:00:00 bells_copy
10962 pts/1 00:00:00 bells_copy
11067 pts/1 00:00:00 ps

The bells and bells_copy are scripts which I wrote. some were stopped with Ctrl-Z while others were allowed to run normally.
timeout is a command that is executed from within a function in both scripts and at Ctrl-Z, the timeout command is killed using "killall timeout". Can anyone explain why the exit command refuses to exit the terminal?
I tried killing the processes individually using their <pid>s but ps gives the same report as jobs i.e no change.
How do i go about trashing the terminal successfully with exit?

 PostPosted: Mon Sep 24, 2012 8:11 am   

Joined: Mon Sep 24, 2012 7:48 am
Posts: 5
If you have one or more jobs stopped with CTRL-Z, you can bring one to the foreground with the fg command.

 PostPosted: Mon Sep 24, 2012 2:46 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
It doesn't refuse to exit the terminal.
It informs you that you've running processes in the background owned by your current shell, in case you don't remember it.

If you don't care about it, just enter exit a second time, and your shell will kill those processes then exit.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group