LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-17-2013, 07:32 AM   #1
floorripper
Member
 
Registered: Oct 2011
Location: Central Europe
Distribution: ubuntu 14.04
Posts: 45

Rep: Reputation: Disabled
how to run a terminal command that will open in a new terminal automatically


Hello,

I am trying to log in into a device.

I have written a script which logs me in into another system,router via ssh.
When go to the router, and I make "show users" I see my new established ssh session on the new VTY. So he makes it subtle.


Code:
#!/bin/bash
#
clogin $1
clogin is my automatic login script, which comes from a Rancid package,it runs on echo,expect. But that's run fine. It also takes the variable. TCP session is established but I do not see it in the new terminal.
That's the main point. I need it to open a new window automatically and to log me in this window.

Last edited by floorripper; 06-17-2013 at 07:33 AM.
 
Old 06-17-2013, 08:24 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
this line runs a terminal emulator on the current display and executes SSH in it:
Code:
x-terminal-emulator -e 'ssh localhost.localdomain' &
 
Old 06-17-2013, 08:29 AM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Try:

Code:
nohup xterm -e clogin $1 &
 
Old 06-18-2013, 03:15 AM   #4
floorripper
Member
 
Registered: Oct 2011
Location: Central Europe
Distribution: ubuntu 14.04
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
Try:

Code:
nohup xterm -e clogin $1 &

hello, thanks, this one works fine thank you!!! One last question how to use it with gnome-terminal, so i can use my default font/color settings and so one.

I have tried
Code:
nohup /usr/bin/gnome-terminal -e clogin $1 &
but that does not work
 
Old 06-18-2013, 03:26 AM   #5
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
you missed quotes, they are in example…
 
Old 06-18-2013, 03:36 AM   #6
floorripper
Member
 
Registered: Oct 2011
Location: Central Europe
Distribution: ubuntu 14.04
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Ygrex View Post
you missed quotes, they are in example…
Hello yes this works fine for a GUI gnome terminal emulator:

Code:
nohup x-terminal-emulator  -e clogin $1 &
tank you so much guys, this script works unless I have route to the desired subnet. I will try to modify it when wee need to use a "hopping station". Then I will post again.
 
  


Reply

Tags
linux, redirection, ssh, terminal



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically run command in terminal after x minutes of idle time. williantalvane Linux - General 3 02-21-2013 11:21 PM
How to open terminal automatically at run level 5 gardenair Linux - Newbie 6 06-26-2010 10:19 AM
[SOLVED] Script to run terminal interface program automatically JoeyJoeJoeJr Programming 2 01-18-2010 12:21 PM
How can Fedora run automatically a Terminal command at the startup? cesar7160 Fedora 4 05-19-2009 11:54 AM
start terminal & run command automatically peeples Linux - General 2 09-08-2003 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration