Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to run an application in a terminal
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Thu May 11, 2017 4:32 pm    Post subject: how to run an application in a terminal Reply with quote

Hello Everyone,
I wondered if anyone could assist me in running an application when gentoo startup.
I have the below file in /etc/local.d/myssh.start


#!/bin/sh
echo "starting ssh socks!"

ssh -D 8123 -f -C -q -N me@localhost -p 9822 -v -v -v -v -v -v

I expect the bash to run in a terminal when I startup gentoo.
Please can anyone help me on how to accomplish this ?


Thanks in advanced.

Ja
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Thu May 11, 2017 5:40 pm    Post subject: Reply with quote

Have one of your teminals (ttys) login as you. I do this in inittab, adjusting the appropriate "getty" line.

My user cboldt is automatically logged into tty6 when the system starts up.

Code:
c6:2345:respawn:/sbin/mingetty --autologin cboldt tty6


Your innittab may call for agetty or mgetty instead of mingetty. I don't know the agetty or mgetty syntax for autologin of a user.

Even if your user doesn't autologin, you can cause bash to do something on a fixed tty, when login occurs at that tty.
To get bash to do something, but ONLY when a user logs in to a specified tty, make an entry in /etc/bash/bashrc.d
All the files in /etc/bash/bashrc.d are run at startup of bash. This script limits the startup action to an instance where startup occurs on tty6

Code:
# /etc/bash/bashrc.d/tty6-startup

# /etc/inittab has an autologin on tty6
# After starting bash, but only on that specific tty, run screen

[ `tty` = /dev/tty6 ] && screen


In your case, rather than run "screen," you would run your ssh command.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Fri May 12, 2017 2:41 pm    Post subject: Reply with quote

Sorry for my late response.
I get the error INIT ld c6 respawning too fast: disabled for 5 minutes.

Though this is how I edited the /etc/inittab

c6:234:respawn:/usr/local/bin/myssh.start myname tty6 38400


Is there anything else I am doing wrong ?

Thanks
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14397

PostPosted: Fri May 12, 2017 11:02 pm    Post subject: Reply with quote

Yes. You asked for help, but did not post the information we need to help you. ;) Since you changed the path, I would prefer not to assume that the new script has the same contents as shown in the opening post.

Please post the output of ls -l /usr/local/bin/myssh.start ; cat -n /usr/local/bin/myssh.start.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Sat May 13, 2017 9:13 am    Post subject: Reply with quote

You didn't follow the instructions.

myssh.start does NOT belong in innittab. A "getty" program does.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Sun May 14, 2017 2:53 pm    Post subject: Reply with quote

I really appreciated your concerned. I have been busy doing some other job.
This is what you requested

Code:

 ls -l /usr/local/bin/myssh.start
 -rwxr-xr-x 1 root root 106 May 12 16:45 /usr/local/bin/myssh.start
Code:

 cat -n /usr/local/bin/myssh.start
 
 
     1   #!/bin/sh
     2   echo "starting ssh socks!"
     3   
     4   ssh -D 8123 -f -C -q -N bileda@localhost -p 9822 -v -v -v -v -v -v
     5   


Thanks a lot

[Moderator edit: added [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 11:18 am    Post subject: Reply with quote

Hi cboldt,
I have tried your both suggetion but none of them work.
This is my inittab file and what I have tried so far.

Code:
#
# /etc/inittab:  This file describes how the INIT process should set up
#                the system in a certain run-level.
#
# Author:  Miquel van Smoorenburg, <miquels@cistron.nl>
# Modified by:  Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
# Modified by:  Daniel Robbins, <drobbins@gentoo.org>
# Modified by:  Martin Schlemmer, <azarah@gentoo.org>
# Modified by:  Mike Frysinger, <vapier@gentoo.org>
# Modified by:  Robin H. Johnson, <robbat2@gentoo.org>
# Modified by:  William Hubbs, <williamh@gentoo.org>
#

# Default runlevel.
id:3:initdefault:

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/openrc sysinit

# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/openrc boot

l0:0:wait:/sbin/openrc shutdown
l0s:0:wait:/sbin/halt -dhnp
l1:1:wait:/sbin/openrc single
l2:2:wait:/sbin/openrc nonetwork
l3:3:wait:/sbin/openrc default
l4:4:wait:/sbin/openrc default
l5:5:wait:/sbin/openrc default
l6:6:wait:/sbin/openrc reboot
l6r:6:wait:/sbin/reboot -dkn
#z6:6:respawn:/sbin/sulogin

# new-style single-user
su0:S:wait:/sbin/openrc single
su1:S:wait:/sbin/sulogin

# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
#c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c1:12345:respawn:/sbin/agetty -a USERNAME --noclear 38400 tty1 linux
#c1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologin -s 38400 tty1 linux
#c2:2345:respawn:/sbin/agetty 38400 tty2 linux
np2:2345:respawn:/sbin/agetty -l /usr/local/bin/autologinssh -n 38400 tty2 linux
#c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c3:2345:respawn:/sbin/agetty -l /usr/local/bin/autologinssh -n 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux
#c6:2345:respawn:/sbin/agetty -a USERNAME /etc/local.d/myssh.start tty6
#c6:2345:respawn:/usr/local/bin/autologin bileda tty6 38400
#c6:2345:respawn:/sbin/agetty -a USERNAME--noclear 38400 tty1 linux
c6:2345:respawn:/sbin/agetty -a USERNAME -n -l /usr/local/bin/autologinssh -s 600 tty6 linux


# SERIAL CONSOLES
#s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100

# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.
x:a:once:/etc/X11/startDM.sh


I can do autologin without a password.
I use i3 for my Desktop.

When I run ps -fAH , this is the output on my autologin :

Code:
 164 root      3237     1  0 13:02 tty2     00:00:00   /bin/sh /usr/local/bin/autologinssh
    165 root      3250  3237  0 13:02 tty2     00:00:00     ssh -D 8123 -f -C -q -N me@localhost -p 9822 -v -v -v -v -v -v
    166 root      3238     1  0 13:02 tty3     00:00:00   /bin/sh /usr/local/bin/autologinssh
    167 root      3254  3238  0 13:02 tty3     00:00:00     ssh -D 8123 -f -C -q -N me@localhost -p 9822 -v -v -v -v -v -v
    168 root      3239     1  0 13:02 tty5     00:00:00   /sbin/agetty 38400 tty5 linux
    169 root      3240     1  0 13:02 tty6     00:00:00   /bin/sh /usr/local/bin/autologinssh -f bileda
    170 root      3253  3240  0 13:02 tty6     00:00:00     ssh -D 8123 -f -C -q -N me@localhost -p 9822 -v -v -v -v -v -v


I am wondering why my ssh command is running as root and not as a user ?

Please do assist me .

Thanks.

[Moderator edit: added [code] tags to preserve output layout. Again. -Hu]
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Mon May 22, 2017 3:45 pm    Post subject: Reply with quote

You have NOT demonstrated that you have tried any part of my two-part suggestion. You are trying other things.

My suggestion did NOT include anything at all that resembled changing the login program, which is what you did with

Code:
c6:2345:respawn:/sbin/agetty -a USERNAME -n -l /usr/local/bin/autologinssh -s 600 tty6 linux


The gist of my suggestion kicks in when the login program invokes a shell program, specifically "bash" by way of example.

Also, the gist of my example has absolutely NOTHING to do with the desktop, in your case "i3," in my case "fvwm." It only works against a console terminal, tty6 by way of example, but you get to pick which console terminal is set-up to automatically start "whatever."

If you were to actually follow my example, your line in initab would read

Code:
c6:2345:respawn:/sbin/agetty -a PUT-YOUR-ACTUAL-USERNAME-HERE  tty6 linux


When this runs, user "PUT-YOUR-ACTUAL-USERNAME-HERE" (who needs to exist) is automatically logged into tty6. If nothing else is done, the console at the tty6 terminal will display the message of the day, any other "standard greeting," typically machine name, and a command line prompt from the shell program.

But if the shell program is told to run something when it is first invoked, and that something varies or is added when the shell program is invoked on a particular console terminal (tty6 by way of example), then what appears when a person logs into that console terminal could be something other than the usual command line prompt from the shell program. In your OP, you asked about starting an ssh application, on startup, and in a terminal.

Getting the shell program to start something automatically is NOT done by changes in inittab. The changes in inittab accomplish automatically logging in to one console terminal, and nothing else. This is the first part of my two-part suggestion.

The second part of my suggestion was getting the shell program to automatically start an application when any user invoked that shell program as a login shell, but only when invoking a login shell on one specific console terminal. In my example, this console terminal is at tty6.

The second part of my suggestion works independently of automatically logging in.

What I suggested may not be at all what you want. Maybe you want a terminal under i3 to have the ssh application running. That is possible too, but would be done in a totally different way.

Edit to add: in your agetty command, are you literally applying "-a USERNAME" or do you substitute the name of a user for "USERNAME"? If you are literally applying "-a USERNAME" instead of "-a lamon99" (or whatever your username is), maybe agetty substitutes USER=root for USER=USERNAME, on account of there is no user called USERNAME.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 3:58 pm    Post subject: Reply with quote

Thanks a lot for your patience and explanation. First off my autologin is ssh. I changed the name of the file to autologin. Sorry I was a bit frustrated.
What I had wanted is what you just mentioned, I had like to have terminal under i3 to have the ssh application running.

I substituted a name for USERNAME; lamon99.
Cheers
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Mon May 22, 2017 4:10 pm    Post subject: Reply with quote

I don't know i3 startup language, but somewhere and somehow, i3 starts "xterm" or 'aterm" or "urxvt" or some other terminal program.

All the "xterm" type terminals have a command line switch to automatically run a program when the terminal is opened. I don't know if you want this ssh application to run on every terminal you open (you ran it on three console terminals in your recent report), or just selected ones.

I also don't know enough about i3 in general or your installation of i3 to tell you how to affect (by "affect," I mean that you want your ssh program to start when the xterm is opened) all or only selected "xterm" programs to start when you start i3.

Edit to add: I hesitate, but maybe there is a language barrier. "Under i3" can be taken more than one way. It can be taken as describing what is totally hidden when i3 is running (many console terminals, commonly viewed and accessed with Ctl-Alt-F6 type key combinations); or it can be taken as a terminal window that appears in the i3 window environment.

The above suggestions relating to "xterm" and other terminals refer to terminal windows that appear in the i3 window environment.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 4:28 pm    Post subject: Reply with quote

All what I am trying to do is to run the ssh on a terminal when I am in xterm. The ssh needs a separate terminal to run. The ssh is a sock that I use on my firefox. I find it very boring typing it everytime I start the firefox.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Mon May 22, 2017 5:05 pm    Post subject: Reply with quote

How do you open that xterm?

Is it literally an xterm, or is it some other terminal program like aterm or urxvt?

I want to find the command line that invokes opening that terminal, and at least use it as an example. i3 allows keystroke definitions too. Plenty of ways to skin this cat.

Using urxvt and a few of the "run THIS command when THIS terminal is opened" examples, from my fvwm startup files

Code:
SetEnv XTERM urxvt

Exec $[XTERM] -name ULynx -g 100x52-200-50 -e attach lynx
Exec $[XTERM] -name Utop -g 80x60+856+32 -e sudo top -d12


For urxvt, the "-e" switch precedes a command. The first of two examples above behaves as if a terminal was opened, and "attach lynx" was typed at the prompt. The second behaves as if a terminal was opened and "sudo top -d12" was typed at the prompt.

I use the "-name" parameter for other purposes, like cursor color, background, prompt color, and other things that can be set in my ~/.XDefaults file.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 5:32 pm    Post subject: Reply with quote

I run startx at the commandline. And it takes me to X .
I tried xterm -e bash --rcfile /usr/local/bin/autologin it is not working either.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Mon May 22, 2017 5:55 pm    Post subject: Reply with quote

When you type startx, and i3 starts, are any terminal windows opened?

From a console terminal (the one you type "startx" from), the "xterm" command won't work at all.

Also, the "--rcfile" switch for bash is probably not what you want to use.

Does typing "autologin" at the command prompt in a xterm (in i3) do what you expect?

Next step, from an xterm, run the command `xterm`. That should open another terminal, with a command prompt. You can type "exit" from the prompt in the new (xterm) window to quit that instance.

Next step, from an xterm, run the command `xterm -e autologin`. That should open another terminal, but this time with the same stuff showing in the new xterm, that shows in the original/first xterm when you type `autologin` in it.

We still have to figure out how to get i3 to do this automatically, but first lets prove that it works manually.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 6:25 pm    Post subject: Reply with quote

It works if I run it manually. The automatic running is my problem.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Mon May 22, 2017 6:43 pm    Post subject: Reply with quote

Does it work when you type "xterm -e autologin" from another xterm?

As for getting this to run automatically, does ANY xterm open (automatically) when you start i3?
The default terminal for i3 is something called "i3-sensible-terminal" which i have never heard of before now.

What files do you have in the ~/.config/i3 directory?

What is the output of `ls -l $(which i3-sensible-terminal)`

The default i3 config file has this line in it ...

Code:
bindcode $mod+36 exec i3-sensible-terminal


This provides that some key combination, I can figure it out but don't know it, results in a new terminal window opening. It is possible to define additional key combinations under i3, but for now I want to know how you open terminal windows, and also, how you WANT to open one (or more) terminal window including the automatic invocation of ssh.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 7:21 pm    Post subject: Reply with quote

Code:
set $mod Mod4
set $term sakura
########################################################
########      Autostart      ########
########################################################
#exec ~/.screenlayout/dualdtop.sh
exec (sleep 3s && ~/start_conky_btm.sh) &

#exec (sleep 7s && ~/start_conky.sh) &
#exec (sleep 7s && ~/start_conky_clock.sh) &

exec (sleep 7s && ~/startup.sh) &
exec (sleep 10s && ~/.Conky2/startconky.sh) &

exec (sleep 3s && ~/rand-wallpapers ) &
exec (sleep 3s && ~/.i3/autostart.sh) &

#exec opera
#exec geany
exec volumeicon
exec parcellite
#exec feh --bg-scale '/home/bileda/images/wallpapers/Gentoo12-wallpapers-20-1600gi.png'
#exec feh --bg-scale '/home/bileda/images/wallpapers/leather_asus_wallpaper_by_bobakazooboy-d3b37s8.png'
#exec feh --bg-scale '/home/bileda/images/wallpapers/4DoE6Pi.jpg'

#exec feh --bg-scale '/home/bileda/New/thumb-1920-177606.jpg

#######################################################
########      Workspaces      ########
########################################################
# switch to workspace
bindsym Mod4+1 workspace "1: web"
bindsym Mod4+2 workspace "2: irc"
bindsym Mod4+3 workspace "3: geany"
bindsym Mod4+4 workspace "4: ranger"
bindsym Mod4+5 workspace "5: terminator"
bindsym Mod4+6 workspace "6: vlc"
bindsym Mod4+7 workspace "7: mail"
bindsym Mod4+8 workspace "8: firefox"
bindsym Mod4+9 workspace "9: music"
bindsym Mod4+0 workspace "10: abiword"

## Output certain workspaces
workspace "1: web" output VGA-1
workspace "2: irc" output VGA-1
workspace "3: geany" output VGA-1
workspace "4: ranger" output VGA-1
workspace "5: terminator" output VGA-1
workspace "6: vlc" output VGA-1
workspace "7: mail" output VGA-1
workspace "8: firefox" output VGA-1
workspace "9: music" output VGA-1
workspace "10: abiword" output VGA-1

## Assign workspaces to programs
#assign [class="^Google-chrome$" instance="^google-chrome$"] → 1: web
assign [class="^Opera$" instance="^opera$"] → 1: web
assign [class="^Geany$" instance="^geany"] → 3: geany
assign [class="^Vlc$" instance="^gl$"] → 6: vlc
assign [class="^Firefox$" instance="^Navigator$"] → 8: firefox
assign [class="^Gvim$" instance="^emacs$"] → 9: gvim
assign [class="^libreoffice-startcenter$" instance="^VCLSalFrame.DocumentWindow$"] 10: office

# move focused container to workspace
bindsym Mod4+Shift+1 move workspace 1
bindsym Mod4+Shift+2 move workspace 2
bindsym Mod4+Shift+3 move workspace 3
bindsym Mod4+Shift+4 move workspace 4
bindsym Mod4+Shift+5 move workspace 5
bindsym Mod4+Shift+6 move workspace 6
bindsym Mod4+Shift+7 move workspace 7
bindsym Mod4+Shift+8 move workspace 8
bindsym Mod4+Shift+9 move workspace 9
bindsym Mod4+Shift+0 move workspace 10

########################################################
########      Aesthetics      ########
########################################################
# Window border style: normal: border normal, with window title bar;
# none: no border or window title bar; 1pixel: 1 pixel border.
new_window 1pixel
bindsym $mod+t border normal
bindsym $mod+y border 1pixel
bindsym $mod+u border none

# font for window titles. ISO 10646 = Unicode
#font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
font pango:DejaVu Sans Mono 10

# Orientation for new workspaces
# Can be set <horizontal|vertical|auto>
default_orientation horizontal

# Layout for new containers
# Can be set <default|stacking|tabbed>
workspace_layout default

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

########################################################
########      Keybindings      ########
########################################################

# start a terminal
#bindsym $mod+Return exec i3-sensible-terminal
#bindsym $mod+Return exec terminator
bindsym $mod+Return exec sakura

# kill focused window
bindsym $mod+Shift+Q kill

# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+J move left
bindsym $mod+Shift+K move down
bindsym $mod+Shift+L move up
bindsym $mod+Shift+colon move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen

# change container layout (stacked, tabbed, default)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout default

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindcode $mod+d focus child

# reload the configuration file
bindsym $mod+Shift+C reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+R restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+E exit

# resize window (you can also use the mouse for that)
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode
        # They resize the border in the direction you pressed, e.g.
        # when pressing left, the window is resized so that it has
        # more space on its left

bindsym j resize shrink left 10 px or 10 ppt
bindsym Shift+J resize grow left 10 px or 10 ppt

bindsym k resize shrink down 10 px or 10 ppt
bindsym Shift+K resize grow down 10 px or 10 ppt

bindsym l resize shrink up 10 px or 10 ppt
bindsym Shift+L resize grow up 10 px or 10 ppt

bindsym semicolon resize shrink right 10 px or 10 ppt
bindsym Shift+colon resize grow right 10 px or 10 ppt

        # same bindings, but for the arrow keys
bindsym Left resize shrink left 10 px or 10 ppt
bindsym Shift+Left resize grow left 10 px or 10 ppt

bindsym Down resize shrink down 10 px or 10 ppt
bindsym Shift+Down resize grow down 10 px or 10 ppt

bindsym Up resize shrink up 10 px or 10 ppt
bindsym Shift+Up resize grow up 10 px or 10 ppt

bindsym Right resize shrink right 10 px or 10 ppt
bindsym Shift+Right resize grow right 10 px or 10 ppt

        # back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"

########################################################
########      i3bar         ########
########################################################

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
    status_command    i3status -c ~/.i3status.conf
    position          bottom
    mode              dock
    workspace_buttons yes

    #font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
    font xft:DejaVu Sans Mono 13
    colors {
        background #000000
        statusline #FFFFFF

        focused_workspace  #ffffff #9932CC
        active_workspace   #ffffff #DA70D6
        inactive_workspace #888888 #242424
        urgent_workspace   #ffffff #32CD32
    }
}


Code:
 ls -l $(which i3-sensible-terminal)
ls: cannot access 'i3-sensible-terminal': No such file or directory


I use window key + 1 to 9 to open terminal from 1 to 9 . And I can open more terminal using the same method.

[Moderator edit: added [code] tags to preserve output layout. Again. -Hu]
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Mon May 22, 2017 7:41 pm    Post subject: Reply with quote

Thank you very much for all you suggested.
I have done it. I edited the i3 config file, and it works.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Mon May 22, 2017 8:10 pm    Post subject: Reply with quote

How do you WANT the system to behave?

From the file you posted, which I believe is ~/.config/i3/config, you have many options for where to cause an autostarted terminal that is running your autostart script:

An entry in ~/startup.sh could be used to cause a terminal to open when i3 starts.
An entry in ~/.i3/autostart.sh could be used to cause a terminal to open when i3 starts.
An entry in directly ~/.config/i3/config (See the "Autostart" section near the top?) could be used to cause a terminal to open when i3 starts. Maybe it is best to avoid this in the long run, because the file ~/.config/i3/config supposedly can be overwritten by the configuration wizard, "i3-config-wizard." But for talking purposes, I am going to instruct you to make changes here.

From other internet resources, there is at least one additional file that may be used to cause an autostarted terminal that is running your autologin script:

An entry in ~/.i3/config ould be used to cause a terminal to open when i3 starts.

Also from the file you posted, which I believe is ~/.config/i3/config, I believe the xterm you are using is called "sakura" I have never heard of that. I did research the command "i3-sensible-terminal" which is basically a terminal chooser, it is not a terminal itself. From the file you posted, I am going to assume your terminal is "sakura" I researched the command line parameters for the sakura teminal, and it uses "-e" the same way that xterm, urxvt, and most other xterms do.

I want you to add one line to the file you shared - context should be clear from this ...

Code:
#exec feh --bg-scale '/home/bileda/New/thumb-1920-177606.jpg

# Added command to autostart a terminal with ssh command
exec sakura -e /usr/local/bin/autologin

#######################################################
######## Workspaces ########
########################################################


If you don't care about getting that echo'd message produced by your "autologin" script, you could change the added command line to

Code:
exec sakura -e ssh -D 8123 -f -C -q -N bileda@localhost -p 9822 -v -v -v -v -v -v


Changing the line or lines that define the behavior of "window key + 1 to 9" will change the results of pressing one of more of those combinations, although I don't see those combinations defined in ~/.config/i3/config (the file i think you showed). I am going to assume you don't care about this, because all you want to do automatically is start one terminal, and have that terminal run your ssh command (autostart) when you start i3 by typing "startx" from a console terminal.
Back to top
View user's profile Send private message
Lamon99
n00b
n00b


Joined: 14 Mar 2016
Posts: 20

PostPosted: Tue May 23, 2017 6:22 am    Post subject: Reply with quote

Thanks a lot for all your support.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum