paul_y3k Posted May 3, 2007 Share Posted May 3, 2007 just thought I'd give it a whirl here ... I'm currently doing some upgrade work on a unix server. The install program goes off and runs several sql scripts in the background, and given the large size of the database this takes several hours to complete. I'm finding that no matter what i use ... putty, telnet etc that after 2.5 hours just sat in the installer waiting for the next prompt the session timesout or in the case of putty i get a network error disconnect message. it seems that theres some sort of timeout here, but I'm jiggered if i can find it. Quote Link to comment Share on other sites More sharing options...
Pete Posted May 3, 2007 Share Posted May 3, 2007 Run it with an ampersand on the end of the line - that way it'll run in the background regardless of your connection. You may need to redirect output depending upon what you're doing. Quote Link to comment Share on other sites More sharing options...
paul_y3k Posted May 3, 2007 Author Share Posted May 3, 2007 yeah i thought that or using nohup, the problem is i need to see the script and eventually at certain point provide responses. also when it comes to live theres no way i'll be able to get away with that Quote Link to comment Share on other sites More sharing options...
Bobbeh Posted May 3, 2007 Share Posted May 3, 2007 it seems that theres some sort of timeout here, but I'm jiggered if i can find it. Are you going through a firewall of some sorts to an external server? That could be a reason for the timeout. I'd have suggested nohup too, but wouldnt be too good if you need to enter values as it goes.. can you not hardcode them into the script? Quote Link to comment Share on other sites More sharing options...
Wez Posted May 3, 2007 Share Posted May 3, 2007 There is also another app you can run called 'screen' you run your scripts in that and if the connection dies connect again and bring the screen to front showing your script. Quote Link to comment Share on other sites More sharing options...
Bobbeh Posted May 3, 2007 Share Posted May 3, 2007 Thing is if the connection died so would his script if hes patching a database. Quote Link to comment Share on other sites More sharing options...
Wez Posted May 3, 2007 Share Posted May 3, 2007 I thought with screen if the connection dies the app running stays alive, when you reconnect you run screen to bring back your session. Quote Link to comment Share on other sites More sharing options...
Pixelfill Posted May 3, 2007 Share Posted May 3, 2007 on SGI IRIX you can run 'nohup' which keeps the session active. on Linux you could try 'set autologout 0' which might help Mike Quote Link to comment Share on other sites More sharing options...
Pixelfill Posted May 3, 2007 Share Posted May 3, 2007 oops should have read the whole thread before suggesting nohup - rather than skim reading Mike Quote Link to comment Share on other sites More sharing options...
Bobbeh Posted May 3, 2007 Share Posted May 3, 2007 I thought with screen if the connection dies the app running stays alive, when you reconnect you run screen to bring back your session. If hes running a SQL script from a SQL prompt, it will die if the session dies, if you nohup it to run in the background it will continue on the server and not rely on the terminal to run. But as he says, he needs to type in values when prompted so he cant nohup it unless he hardcodes the values. Quote Link to comment Share on other sites More sharing options...
Scoboblio Posted May 3, 2007 Share Posted May 3, 2007 It's several hours in a noisy cold machine room infront of a console for you! There isn't some kind of cron job or something that's killing off sessions after a max time? Just a couple of n00000000by type suggestions spawned by my half quarter-arsed unix knowledge. Quote Link to comment Share on other sites More sharing options...
Wez Posted May 3, 2007 Share Posted May 3, 2007 If hes running a SQL script from a SQL prompt, it will die if the session dies, if you nohup it to run in the background it will continue on the server and not rely on the terminal to run. But as he says, he needs to type in values when prompted so he cant nohup it unless he hardcodes the values. Using Screen for Session Management You are logged into your remote server via SSH and happily plucking along at your keyboard and then it happens. Suddenly, the characters stop moving and then you get the dreaded "Connection Closed" message. You have just lost your session. You were halfway through some task and now you have to start over. Ugh. Well you can prevent this from happening by using screen. Screen can not only save you from disconnection disasters, but it also can increase your productivity by using multiple windows within one SSH session. What is Screen? As the man page states, "Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells)." This can be a life saver when working on your dedicated server. Screen has a several great features for helping you administer your server more productively and safely. I am going to discuss the three features (multiple windows, logging, sessions) that I use the most but be sure to see the man page for full details. Quote Link to comment Share on other sites More sharing options...
Wez Posted May 3, 2007 Share Posted May 3, 2007 Example, login and type screen, then run something like top and kill your connection. Login again and type screen -ls to list the screens running, it should now have one detached. Type screen -r followed by the screen in the list and it will recover and you should be presented with Top which you started on the previous login. Works for me Quote Link to comment Share on other sites More sharing options...
paul_y3k Posted May 4, 2007 Author Share Posted May 4, 2007 hmm interesting .. i'll have a play with these screen. I actually found it to be a problem with both putty and telnet .. that after 2.5 off no foreground activity the session is disconnected. Our unix bods cant answer why though. I've managed to work around it by using an xwindows client session, on this server, but i dont know if its an option on live as xwin is disabled lol. ohh what fun. Quote Link to comment Share on other sites More sharing options...
Konrad Posted May 4, 2007 Share Posted May 4, 2007 When session die, screen will still be alive as it is server sided - also easy to use really. Ctrl+A Ctrl+D I think putty is da best Quote Link to comment Share on other sites More sharing options...
paul_y3k Posted May 4, 2007 Author Share Posted May 4, 2007 putty is fine ... unless of course you''re doing an install that lasts longer than 2.5 hours ! Quote Link to comment Share on other sites More sharing options...
cheekymonkey Posted May 4, 2007 Share Posted May 4, 2007 Hi again Paul! Wow - a supra owner in swindon who's also a UNIX guy. We definately should meet up. You can see my server room *grin* I use screen on a daily basis, it's great for kicking jobs off at home, and then re-attaching elsewhere, either at work or from my Treo to check progress. Really handy stuff! James Quote Link to comment Share on other sites More sharing options...
Bobbeh Posted May 4, 2007 Share Posted May 4, 2007 Wez, thanks for that, I'll have a nose Wez, is that screen a 3rd party program? I've checked one of our HP-UX boxes and a Sun box and theres nothing. Paul, yeah Putty is nice Quote Link to comment Share on other sites More sharing options...
paul_y3k Posted May 4, 2007 Author Share Posted May 4, 2007 lol oo-err ! I'm more a BPM person, just have to use unix alot in my day to day projects. certinaly no administrator ! find me down the tawny owl most nights mate ! Quote Link to comment Share on other sites More sharing options...
cheekymonkey Posted May 4, 2007 Share Posted May 4, 2007 BPM? Sadly I am Unix Geek except I don't have long hair! Tawny is nice, my brother's local. The new pub up by me is nice as well if you like modern styled pubs, good food and have a load of guest ales at the moment. Quote Link to comment Share on other sites More sharing options...
Bobbeh Posted May 4, 2007 Share Posted May 4, 2007 Paul, just a thought, why not try a VNC server session to your unix box, that way you can connect to the desktop, then if your session dies, you can reconnect and your terminal window will still be there waiting for your responses. Just make sure your profiles are running correctly when you open the terminal windows Quote Link to comment Share on other sites More sharing options...
Wez Posted May 4, 2007 Share Posted May 4, 2007 Wez, thanks for that, I'll have a nose Wez, is that screen a 3rd party program? I've checked one of our HP-UX boxes and a Sun box and theres nothing. Paul, yeah Putty is nice Yeah, but its available for free for most platforms. Quote Link to comment Share on other sites More sharing options...
Bobbeh Posted May 4, 2007 Share Posted May 4, 2007 We found it on one of our linux boxes but it wasnt on our various unix ones.. so we're downloading it to have a look Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.