Unix scripting and screen session


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix scripting and screen session
# 1  
Old 06-19-2012
Unix scripting and screen session

hi, i am on AIX 5.3. I would like to write scripts that initiate or reattach to a screen session to run some commands either from unix or Universe. Can anyone assist me with a with a wuick primer on this. I can attach or initiate a screen manually and then run the commands but I would like to automate this such that i run a single command for all.
# 2  
Old 06-19-2012
Are you talking about GNU screen available from the AIX toolbox for linux?

What is the manual process you are using at the moment?
# 3  
Old 06-20-2012
I got a small program like

cd /globus/maint/lesmaint1/bnk.run
uv GSS.EXCEPTION

where after the user logs on, change directory and initiate a universe program.
so i want to be ablle to run this in a ascreen in case connection drops.
I have a number of small tasks like this

---------- Post updated at 10:41 AM ---------- Previous update was at 10:40 AM ----------

i am talking about GNU screen yes
# 4  
Old 06-20-2012
You can create a file ~/.screenrc in which you'll write the commands you want to launch at screen startup:
Code:
screen -t title command
screen -t title ~/bin/script

where ~/bin/script can contain:
Code:
cd /globus/maint/lesmaint1/bnk.run
uv GSS.EXCEPTION

for example
# 5  
Old 06-20-2012
This is not something i wish to run at screen startup but after the screen has been initiated and other commands/scripts as well.

I been trying variations of
screen -S TINASHE -p 0 -X stuff 'gsscheckunauth.sh^M'

---------- Post updated at 02:25 PM ---------- Previous update was at 02:09 PM ----------

is there a simple way of sending ENTER to a screen?
# 6  
Old 06-20-2012
Try this then:screen -S sessionname -X screen command
# 7  
Old 06-20-2012
I googled and tweaked and eventually arrive at
screen -S scrsession-p 0 -X stuff "`script.sh '\015'`"which seems to be working for me now.

or use this in xxx.sh
screen -dmS spawner sleep 30
screen -S spawner -X screen screen -dR mydaemon
sleep 1
screen -S mydaemon -X detach
screen -S mydaemon -X stuff "`uv GSS.EXCEPTION '\015'`"
and call that from unix, will run in a screen!

Thank you all for your effotrs
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Linux

Is it possible to set timeout on Linux screen session

Hello friends, I work on Linux servers via SSH (putty) and run "screen" to preserve my sessions so I can attach/detach them at anytime I wish without losing the connectivity/process disruption which is working perfectly fine. As my team members also have root access to those servers, it is... (7 Replies)
Discussion started by: prvnrk
7 Replies

2. HP-UX

Get blank screen when killing a UNIX session on HP-UX

Hi, I have this Unix script that kills a user session. When I run it, my screen goes blank. How do I prevent the blank screen? Ex: I open 2 Unix sessions. The main PID for my 1st session is 1234. In the second session I issue a "kill -HUP 1234". The first session gets killed but the second... (5 Replies)
Discussion started by: rm-r
5 Replies

3. Shell Programming and Scripting

Script that prints 2 messages to a screen session

Im trying to make a script that prints 2 messages to a screen session, one after the other. screen -x session44 -X stuff "`printf "Test 1\r"`" This works fine, but adding a second lien with a different message yields no results. Changed Subject: Please Follow Forum Rules Regarding... (1 Reply)
Discussion started by: kylecn
1 Replies

4. Shell Programming and Scripting

Print from screen session

Hello everyone, Following command sends word 'test' followed by an enter into a screen session (in our case screen_1). How do I print the result, if that would result ? How do I print the result, even if the program running in the session is locked ? Thank you :) screen -S screen_1 -X... (5 Replies)
Discussion started by: akula_1986
5 Replies

5. Fedora

default session in screen command

Hello sir, Im in a Fedora 9 system. Im using screen to invoke the session that is created by me. Whenever we open the terminal then a session is created by the operating system. I want to know what is the name of default session in screen command. I could not get it using "screen -ls". Can you... (3 Replies)
Discussion started by: nsharath
3 Replies

6. Programming

how to clear screen in GDB session

hi , Could any one tell me the command for clearing the screen in GDB session (1 Reply)
Discussion started by: useless79
1 Replies

7. Shell Programming and Scripting

scripting an ssh session?

I know the root login/password for a machines, and I want to automate some commands like this from each: ssh root@remoteHost1 "tail /var/log/messages" ssh root@remoteHost2 "tail /var/log/messages" ssh root@remoteHost3 "tail /var/log/messages" ssh root@remoteHost4 "tail /var/log/messages" ssh... (2 Replies)
Discussion started by: jjinno
2 Replies

8. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies

9. Shell Programming and Scripting

My screen saver for a plain session

Good day. :) I don't know exactly where or how to post this kind of stuff, but I though I'd like to have a look at my "Screen Saver" in progress. Comments welcome. This uses bash. Just copy and pase into any file. Make o+x and run. Feel free to edit and change all u like. Thanks. ... (0 Replies)
Discussion started by: Blooper
0 Replies
Login or Register to Ask a Question