Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help with detaching the screen programmatically Post 302883997 by pandeesh on Friday 17th of January 2014 06:32:31 AM
Old 01-17-2014
Help with detaching the screen programmatically

Hi,

I am using screen utility for protecting from ssh disconnects.
My process flow i ssomething like :

a) I start screen from my desktop terminl.

b)In the screen session, i ssh to one host and execute a command

c)Once the above command is completed,i would like to exit via ctr-a or ctrl-d and send a mail to myself.

Currently, i try
Code:
command_in_remote_host;logout ;echo "it's done"|mail -s "Completed" $USER@domain.com
command_in_remote_host;exit ;echo "it's done"|mail -s "Completed" $USER@domain.com

But, the last command is not getting executed after the ssh is disconnected.

Is there any way i can programmatically simulate ctrl-a or ctrl-d , so that it can detach and send the mail?

Please advise.

Thanks
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Detaching file

How do I detach an attachment using mailx in a script? I haven't a clue vGnp (1 Reply)
Discussion started by: vGnp
1 Replies

2. Solaris

Modify Style Manager programmatically

My Java application runs on SunOS 5.8. Our use of a 3rd party class requires us to modify the Style Manager-Window setting "Allow Primary Windows On Top" - the default for this is on, we need to turn it off. Is there any way for our application, or our installation, to modify this setting? We... (0 Replies)
Discussion started by: ped52
0 Replies

3. Programming

how to find usb ports programmatically

I need to find out where a usb flash memory drive is mounted. I have used prtconf and iostat to find the information and then used popen to parse the information to find what i need. I am wondering if there are some generic functions such as ddi_ or usb_ that i can use to find such info. I would... (1 Reply)
Discussion started by: jtcoelho
1 Replies

4. Programming

Check the Disk usage Programmatically

Hi all, Do we have anyway to get the freediskspace for within a C program? I need functionality similar to 'df -h' -> which gives the % of utilization... Otherwise, if we go and use 'system ("df -h /home/myhome/")', do we have any way of capturing the output into a string and parse the... (2 Replies)
Discussion started by: SriSri
2 Replies

5. Programming

is it SUSE or RHEL or Debian. How to detect programmatically?

Hi Gurus, I want to programmatically detect what Linux flavour I have in my m/c, detailed OS-name and its version, e.g. is it RHEL, SUSE, Debian etc. ---------------------------------------------------------------- Flavour OS-Nname version... (4 Replies)
Discussion started by: krishnamurthig
4 Replies

6. UNIX Desktop Questions & Answers

resize multiple xclients (xterms) on command line or programmatically?

Is there a way to resize x clients after they're started either on the command line or programmatically? I'm using Cygwin and typically start my root window, wm, and four xterms. By the end of the day they're all over the place with different sizes. I'd like to be able to enter a single command... (0 Replies)
Discussion started by: gctaylor
0 Replies

7. UNIX for Advanced & Expert Users

How to get DHCP address change event notification programmatically?

Hello Experts, I am working on a software that has network client-server architecture. I need to have a mechanism that notifies me upon change of dhcp address change locally or at remote machine. Windows have IP Helper APIs to get address change notification. Is there something similar in Unix?... (3 Replies)
Discussion started by: GajendraSharma
3 Replies

8. Shell Programming and Scripting

how to programmatically generate makefile variable

I make to parse the release version from a text file and set the release version label into a Makefile variable. I tried: VERSION := `grep vsn s1db.app|sed -e s/*\"// -e s/\"*//` but looks like make, unlike shell, literally just take the entire `grep ...` as the variable value. Then I tried... (3 Replies)
Discussion started by: benkial
3 Replies

9. Solaris

How to programmatically reset a users password.?

Hello all, I have a small C++ app for my solaris admins. I need to set it up so they can reset a users password. The admin does not have the old password. How can I reset a users password to a temp password either using passwd or PAM? I need to do this from within my C++ app. I have searched... (3 Replies)
Discussion started by: ChickenPox
3 Replies
SCREENCAPTURE(1)					    BSD General Commands Manual 					  SCREENCAPTURE(1)

NAME
screencapture -- capture images from the screen and save them to a file or the clipboard SYNOPSIS
screencapture [-SWCTMPcimswxto] file DESCRIPTION
The screencapture utility is not very well documented to date. A list of options follows. -c Force screen capture to go to the clipboard. -C Capture the cursor as well as the screen. Only allowed in non-interactive modes. -i Capture screen interactively, by selection or window. The control key will cause the screen shot to go to the clipboard. The space key will toggle between mouse selection and window selection modes. The escape key will cancel the interactive screen shot. -m Only capture the main monitor, undefined if -i is set. -M Open the taken picture in a new Mail message. -o In window capture mode, do not capture the shadow of the window. -P Open the taken picture in a Preview window. -s Only allow mouse selection mode. -S In window capture mode, capture the screen instead of the window. -t <format> Image format to create, default is png (other options include pdf, jpg, tiff and other formats). -T <seconds> Take the picture after a delay of <seconds>, default is 5. -w Only allow window selection mode. -W Start interaction in window selection mode. -x Do not play sounds. -a Do not capture attached windows. -r Do not add screen dpi meta data to captured file. files where to save the screen capture, 1 file per screen BUGS
Better documentation is needed for this utility. SECURITY CONSIDERATIONS
To capture screen content while logged in via ssh, you must launch screencapture in the same mach bootstrap hierarchy as loginwindow: PID=pid of loginwindow sudo launchctl bsexec $PID screencapture [options] HISTORY
A screencapture utility first appeared in Mac OS X v10.2. Mac OS June 16, 2004 Mac OS
All times are GMT -4. The time now is 06:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy