This is flawed in several ways:
1) your process flow does NOT protect command_in_remote_host from ssh disconnects!
2) after exit or logout there is no shell to process the other commands.
You have to start the screen utility on the remote host. The commands you execute there will keep running regardless of disconnects.
Your flow should look like this:
a) ssh to host from your desktop terminal
b) start screen on remote host
c) start command in screen session and send notification.
Actually, there is neither screen nor mail/mailx present in the remote host. Hence I started screen from local desktop.
---------- Post updated at 09:04 PM ---------- Previous update was at 06:28 PM ----------
If i press ctrl-a or ctrl-d manually instead of logout/exit as second, then it works fine.
But, i don't see a way to implement programatically ctrl-a or ctrl-d in a shell script.
If there is no screen utility on the remote host you can use nohup instead. It does not offer a virtual terminal like screen but protects the command you started on the remote host from beeing killed when you lose connection.
Without a mailer on the remote host you could use the mailer on your local machine when your ssh-session terminates (something like ssh remote_host "nohup command_on_remote_host"; echo "it's done"|mail -s "Completed" $USER@domain.com), but I do not think that makes much sense because you'd receive the mail when the ssh-session quits for any reason - disconnects included.
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)
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)
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)
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)
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)
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)
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)
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)