Discussion:
Script at the start
(too old to reply)
gamo
2020-12-30 08:03:00 UTC
Permalink
I want that after every reboot and login,
the system excute 3 times

gnome-shell-terminal to the max size

and in one of them cd to a directory


Could I automate this?

Thanks in advance.
--
http://gamo.sdf-eu.org/
"What happens in EuroVegas it remains in EuroVegas"
Bit Twister
2020-12-30 08:55:48 UTC
Permalink
Post by gamo
I want that after every reboot and login,
the system excute 3 times
gnome-shell-terminal to the max size
and in one of them cd to a directory
Could I automate this?
Sounds easy enough. I do not have a ubuntu install to test actual commands.

Basically all you need to do is create a desktop file in your autostart
directory. The desktop file has the script you wish to have executed.

Your script can then use nohup to launch whatever command desired.

I am running xfce as my Desktop Environment, therefore I have a
$HOME/.config/autostart directory. In there I have a link to my desktop
file.

$ ls -l $HOME/.config/autostart/*start*
lrwxrwxrwx 1 bittwister bittwister 47 Jun 27 2020 start/xfce_startup.desktop -> /home/bittwister/local/bin/xfce_startup.desktop

$ cat /home/bittwister/local/bin/xfce_startup.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Xfce_startup
Comment=Local xfce_startup
Exec=/home/bittwister/local/bin/xfce_startup.sh
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false

The point of interest is the shell script
Exec=/home/bittwister/local/bin/xfce_startup.sh

Other than .desktop you get to name the files whatever you like.

For example, your script could be launch_3_terms. With the following:

----8<----8<----8<----8<- cut below this line ---8<----8<----8<
#!/bin/bash
#******************************************************
#* launch_3_terms - launch 3 terminals
#* usually called from autostart directory upon login
#******************************************************

nohup gnome-shell-terminal > /dev/null 2>&1 &
nohup "gnome-shell-terminal -geom 80x50" > /dev/null 2>&1 &
nohup "cd /#HOME/some/where ; gnome-shell-terminal " > /dev/null 2>&1 &


#**************** end launch_3_terms ******************

You save launch_3_terms, set the execute bit
chmod +x launch_3_terms

Test that it works as desired.
./launch_3_terms

If works as desired create your launch_3_terms.desktop file, either
copy or link in your autostart directory, and next login should create
your 3 terminals.
Jonathan N. Little
2020-12-30 14:04:49 UTC
Permalink
Post by Bit Twister
Post by gamo
I want that after every reboot and login,
the system excute 3 times
gnome-shell-terminal to the max size
and in one of them cd to a directory
Could I automate this?
Sounds easy enough. I do not have a ubuntu install to test actual commands.
Basically all you need to do is create a desktop file in your autostart
directory. The desktop file has the script you wish to have executed.
Your script can then use nohup to launch whatever command desired.
I am running xfce as my Desktop Environment, therefore I have a
$HOME/.config/autostart directory. In there I have a link to my desktop
file.
$ ls -l $HOME/.config/autostart/*start*
lrwxrwxrwx 1 bittwister bittwister 47 Jun 27 2020 start/xfce_startup.desktop -> /home/bittwister/local/bin/xfce_startup.desktop
$ cat /home/bittwister/local/bin/xfce_startup.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Xfce_startup
Comment=Local xfce_startup
Exec=/home/bittwister/local/bin/xfce_startup.sh
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
The point of interest is the shell script
Exec=/home/bittwister/local/bin/xfce_startup.sh
Other than .desktop you get to name the files whatever you like.
----8<----8<----8<----8<- cut below this line ---8<----8<----8<
#!/bin/bash
#******************************************************
#* launch_3_terms - launch 3 terminals
#* usually called from autostart directory upon login
#******************************************************
nohup gnome-shell-terminal > /dev/null 2>&1 &
nohup "gnome-shell-terminal -geom 80x50" > /dev/null 2>&1 &
nohup "cd /#HOME/some/where ; gnome-shell-terminal " > /dev/null 2>&1 &
#**************** end launch_3_terms ******************
You save launch_3_terms, set the execute bit
chmod +x launch_3_terms
Test that it works as desired.
./launch_3_terms
If works as desired create your launch_3_terms.desktop file, either
copy or link in your autostart directory, and next login should create
your 3 terminals.
Well your script seems to have problems. Also gamo I think the terminal
is gnome-terminal not gnome-shell-terminal.

So in Ubuntu 20.04 (also will work in earlier version)

#STEP 1 I would put this type of script in ~/bin
mkdir -p ~/bin

#STEP 2 create script launch3terms.sh

nano ~/bin/launch3terms.sh

#!/bin/sh
# Just opens a default terminal in ~/
nohup gnome-terminal > /dev/null 2>&1 &
# Open one 80 cols by 50 rows
nohup gnome-terminal --geometry=80x50 > /dev/null 2>&1 &
# Opens last in documents directory
cd /$HOME/Documents ; nohup gnome-terminal > /dev/null 2>&1 &

#STEP 3 make executable

chmod +x ~/bin/launch3terms.sh

#STEP 4
Activities > Startup Applications > Add

Name: 3 Terms
Command: /home/gamo/bin/launch3terms.sh
(or hit Browse because you need to have absolute path here)
Comment: Whatever...

click Add

#STEP 5
Log out and then back in and you should have three terminal windows
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
gamo
2020-12-31 15:31:17 UTC
Permalink
Post by Jonathan N. Little
Post by Bit Twister
Post by gamo
I want that after every reboot and login,
the system excute 3 times
gnome-shell-terminal to the max size
and in one of them cd to a directory
Could I automate this?
Sounds easy enough. I do not have a ubuntu install to test actual commands.
Basically all you need to do is create a desktop file in your autostart
directory. The desktop file has the script you wish to have executed.
Your script can then use nohup to launch whatever command desired.
I am running xfce as my Desktop Environment, therefore I have a
$HOME/.config/autostart directory. In there I have a link to my desktop
file.
$ ls -l $HOME/.config/autostart/*start*
lrwxrwxrwx 1 bittwister bittwister 47 Jun 27 2020 start/xfce_startup.desktop -> /home/bittwister/local/bin/xfce_startup.desktop
$ cat /home/bittwister/local/bin/xfce_startup.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Xfce_startup
Comment=Local xfce_startup
Exec=/home/bittwister/local/bin/xfce_startup.sh
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
The point of interest is the shell script
Exec=/home/bittwister/local/bin/xfce_startup.sh
Other than .desktop you get to name the files whatever you like.
----8<----8<----8<----8<- cut below this line ---8<----8<----8<
#!/bin/bash
#******************************************************
#* launch_3_terms - launch 3 terminals
#* usually called from autostart directory upon login
#******************************************************
nohup gnome-shell-terminal > /dev/null 2>&1 &
nohup "gnome-shell-terminal -geom 80x50" > /dev/null 2>&1 &
nohup "cd /#HOME/some/where ; gnome-shell-terminal " > /dev/null 2>&1 &
#**************** end launch_3_terms ******************
You save launch_3_terms, set the execute bit
chmod +x launch_3_terms
Test that it works as desired.
./launch_3_terms
If works as desired create your launch_3_terms.desktop file, either
copy or link in your autostart directory, and next login should create
your 3 terminals.
Well your script seems to have problems. Also gamo I think the terminal
is gnome-terminal not gnome-shell-terminal.
So in Ubuntu 20.04 (also will work in earlier version)
#STEP 1 I would put this type of script in ~/bin
mkdir -p ~/bin
#STEP 2 create script launch3terms.sh
nano ~/bin/launch3terms.sh
#!/bin/sh
# Just opens a default terminal in ~/
nohup gnome-terminal > /dev/null 2>&1 &
# Open one 80 cols by 50 rows
nohup gnome-terminal --geometry=80x50 > /dev/null 2>&1 &
# Opens last in documents directory
cd /$HOME/Documents ; nohup gnome-terminal > /dev/null 2>&1 &
#STEP 3 make executable
chmod +x ~/bin/launch3terms.sh
#STEP 4
Activities > Startup Applications > Add
Name: 3 Terms
Command: /home/gamo/bin/launch3terms.sh
(or hit Browse because you need to have absolute path here)
Comment: Whatever...
click Add
#STEP 5
Log out and then back in and you should have three terminal windows
Well, maybe 2 wrongs make a good answer.

~/.config/autostart/ GOOD!
~/bin/ Unnecessary.
nohup Unnecessary.
2 > 1 & Wrong. Are you confusing a Graphic program with
a CLI program, and that do all the work including
runing bash???
gnome-terminal GOOD!

Thank you both. I think it's solved.
Best regards and happy new year!

Post data: gnome-terminal does not accept the option to --maximize.
You have to do it yourself, which is hmm... peculiar
--
http://gamo.sdf-eu.org/
"What happens in EuroVegas it remains in EuroVegas"
Jonathan N. Little
2020-12-31 16:14:02 UTC
Permalink
Post by gamo
Well, maybe 2 wrongs make a good answer.
~/.config/autostart/    GOOD!
~/bin/                  Unnecessary.
Well I said "I would put this type of script in ~/bin"

/bin -> system root use
/usr/bin -> user system wide use on systems
/usr/local/bin -> specific for a particular machine
~/bin -> specific for a particular user profile
Post by gamo
nohup                   Unnecessary.
Yep
Post by gamo
2 > 1 &                 Wrong. Are you confusing a Graphic program with
                      a CLI program, and that do all the work includ
Yep
Post by gamo
runing bash???
gnome-terminal          GOOD!
Thank you both. I think it's solved.
Best regards and happy new year!
Post data: gnome-terminal does not accept the option to --maximize.
You have to do it yourself, which is hmm... peculiar
Works for me

gnome-terminal --maximize
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
gamo
2020-12-31 17:11:15 UTC
Permalink
Post by Jonathan N. Little
Post by gamo
Post data: gnome-terminal does not accept the option to --maximize.
You have to do it yourself, which is hmm... peculiar
Works for me
gnome-terminal --maximize
Ooops! It's genial, but undocumented.
--
http://gamo.sdf-eu.org/
"What happens in EuroVegas it remains in EuroVegas"
Jonathan N. Little
2020-12-31 17:45:24 UTC
Permalink
Post by gamo
Post by Jonathan N. Little
Post by gamo
Post data: gnome-terminal does not accept the option to --maximize.
You have to do it yourself, which is hmm... peculiar
Works for me
gnome-terminal --maximize
Ooops! It's genial, but undocumented.
***@nomad:~$ gnome-terminal --help-window-options
Usage:
gnome-terminal.real [OPTION...]

Window options; if used before the first --window or --tab argument,
sets the default for all windows:
--show-menubar Turn on the menubar
--hide-menubar Turn off the menubar
--maximize Maximize the window
--full-screen Full-screen the window
--geometry=GEOMETRY Set the window size; for example:
80x24, or 80x24+200+200 COLSxROWS+X+Y)
--role=ROLE Set the window role
--active Set the last specified tab as the
active one in its window
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Bit Twister
2020-12-31 19:25:09 UTC
Permalink
Post by gamo
Post by Bit Twister
----8<----8<----8<----8<- cut below this line ---8<----8<----8<
#!/bin/bash
#******************************************************
#* launch_3_terms - launch 3 terminals
#* usually called from autostart directory upon login
#******************************************************
nohup gnome-shell-terminal > /dev/null 2>&1 &
nohup "gnome-shell-terminal -geom 80x50" > /dev/null 2>&1 &
nohup "cd /#HOME/some/where ; gnome-shell-terminal " > /dev/null 2>&1 &
#**************** end launch_3_terms ******************
Well, maybe 2 wrongs make a good answer.
I would have preferred seeing your resulting script.
Post by gamo
~/.config/autostart/ GOOD!
~/bin/ Unnecessary.
nohup Unnecessary.
2 > 1 & Wrong. Are you confusing a Graphic program with
a CLI program, and that do all the work including
nohup was picked to launch the command and & to allow the script to
continue executing the next command.

all the work past the command nohup is to execute was just to keep
nohup from printing out a message and leaving a 'nohup.out' behind.
gamo
2021-01-01 19:31:59 UTC
Permalink
Post by Bit Twister
I would have preferred seeing your resulting script.
Wait few until I reboot to see if I'm wrong.

What I do is simply put in ~/.config/autostart/
simple files like this:

$ cat terminal2
[Desktop Entry]
Type=Application
Name=terminal2
Exec=/usr/bin/gnome-terminal --maximize

...and I cross my fingers.

Happy new year!!!
--
http://gamo.sdf-eu.org/
"What happens in EuroVegas it remains in EuroVegas"
Jonathan N. Little
2021-01-01 20:40:57 UTC
Permalink
Post by gamo
Post by Bit Twister
I would have preferred seeing your resulting script.
Wait few until I reboot to see if I'm wrong.
What I do is simply put in ~/.config/autostart/
$ cat terminal2
[Desktop Entry]
Type=Application
Name=terminal2
Exec=/usr/bin/gnome-terminal --maximize
It will not work. Run this command to fix it.

mv ~/.config/autostart/terminal2 ~/.config/autostart/terminal2.desktop
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Bit Twister
2021-01-01 21:43:44 UTC
Permalink
Post by gamo
Post by Bit Twister
I would have preferred seeing your resulting script.
Wait few until I reboot to see if I'm wrong.
Reboot is not required, Just log out/in.
Post by gamo
What I do is simply put in ~/.config/autostart/
$ cat terminal2
[Desktop Entry]
Type=Application
Name=terminal2
Exec=/usr/bin/gnome-terminal --maximize
I see says the blind man.

You changed the requirement. You started the thread asking to start 3
terminals.
What you have in just one terminal.

You also did not read my post correctly. I indicated that the files
in /autostart need the .desktop extension.

As Jonathan has indicated,
mv ~/.config/autostart/terminal2 ~/.config/autostart/terminal2.desktop

then log out and log in.
gamo
2021-01-02 06:42:29 UTC
Permalink
Post by Bit Twister
Post by gamo
Post by Bit Twister
I would have preferred seeing your resulting script.
Wait few until I reboot to see if I'm wrong.
Reboot is not required, Just log out/in.
Post by gamo
What I do is simply put in ~/.config/autostart/
$ cat terminal2
[Desktop Entry]
Type=Application
Name=terminal2
Exec=/usr/bin/gnome-terminal --maximize
I see says the blind man.
You changed the requirement. You started the thread asking to start 3
terminals.
What you have in just one terminal.
You also did not read my post correctly. I indicated that the files
in /autostart need the .desktop extension.
As Jonathan has indicated,
mv ~/.config/autostart/terminal2 ~/.config/autostart/terminal2.desktop
then log out and log in.
Done. Yes, it works.
Thank you.
--
http://gamo.sdf-eu.org/
"What happens in EuroVegas it remains in EuroVegas"
Continue reading on narkive:
Loading...