Page 1 of 1

How do I put a .sh on startup? [help]

Posted: 05 Dec 2022, 20:13
by mcabel
How do I put this .sh on startup?

Redshift3000.sh

Code: Select all

#!/bin/bash 
redshift -P -O 3000

How do I put a .sh on startup? [help]

Posted: 05 Dec 2022, 21:45
by Ed_P
Add the .sh file to /etc/profile.d as root.

How do I put a .sh on startup? [help]

Posted: 06 Dec 2022, 01:03
by ncmprhnsbl
Ed_P wrote:
05 Dec 2022, 21:45
Add the .sh file to /etc/profile.d as root.
generally, this location is for setting environment variables, not random commands..
putting that command in /etc/rc.d/rc.local is more conventional
or
creating a .desktop file and putting it in ~/.config/autostart (or /etc/xdg/autostart) like this:
redshift.desktop:

Code: Select all

[Desktop Entry]
Version=1.0
Type=Application
Name=redshift
Exec=redshift -P -O 3000

or in that .desktop:
Exec=/path/to/the/script.sh
or
add to the APPEND line of /boot/syslinux/porteus.cfg : guiexec=reshift~-P~-O~3000 (~ replaces spaces) or guiexec=/path/to/the/script.sh

How do I put a .sh on startup? [help]

Posted: 06 Dec 2022, 02:37
by gnintilgyes
ncmprhnsbl wrote:
06 Dec 2022, 01:03
generally, this location is for setting environment variables, not random commands..
putting that command in /etc/rc.d/rc.local is more conventional
or
creating a .desktop file and putting it in ~/.config/autostart (or /etc/xdg/autostart) like this:
redshift.desktop:

Code: Select all

[Desktop Entry]
Version=1.0
Type=Application
Name=redshift
Exec=redshift -P -O 3000

I learned something else about Linux. Even though once I had to tread around "/etc/rc.d" looking how to turn "init 3" into "init 4" after I installed Slackware 32-bit and created a regular user. :)

How do I put a .sh on startup? [help]

Posted: 06 Dec 2022, 06:45
by Ed_P
ncmprhnsbl wrote:
06 Dec 2022, 01:03
Ed_P wrote:
05 Dec 2022, 21:45
Add the .sh file to /etc/profile.d as root.
generally, this location is for setting environment variables, not random commands..
putting that command in /etc/rc.d/rc.local is more conventional
or
creating a .desktop file and putting it in ~/.config/autostart (or /etc/xdg/autostart) like this:
redshift.desktop:

Code: Select all

[Desktop Entry]
Version=1.0
Type=Application
Name=redshift
Exec=redshift -P -O 3000
or in that .desktop:
Exec=/path/to/the/script.sh
or
add to the APPEND line of /boot/syslinux/porteus.cfg : guiexec=reshift~-P~-O~3000 (~ replaces spaces) or guiexec=/path/to/the/script.sh
An excellent posting ncmp. :good: We need to find a way to add it to the forum's help file.

How do I put a .sh on startup? [help]

Posted: 06 Dec 2022, 16:58
by roro
Hi ncmp... and ED_P
Now I've learned two things at once
"desktop file" and "autostart"
That means I have to check the forum every day.

But where do I have to save the desktop file

/home/guest/.config/autostart
or /etc/xdg/autostart

Both: autostart, what is the difference, what is xdg ?

How do I put a .sh on startup? [help]

Posted: 07 Dec 2022, 01:12
by ncmprhnsbl
roro wrote:
06 Dec 2022, 16:58
Both: autostart, what is the difference, what is xdg
/home/guest/.config/autostart starts for guest user only, /etc/xdg/autostart starts for all users (when they login to X)
xdg is an acronym for "X (or cross) desktop group" , which is a freedesktop.org creation that handles/standardizes various functions across desktop environments, like for example: autostart, config file locations, standard desktop folders...
(don't worry, i had to look that up ;) )

How do I put a .sh on startup? [help]

Posted: 26 Mar 2023, 10:36
by Kulle
"Script.sh" file at startup

Two possibilities:

a) creating a .desktop file "Script.sh" and putting it in ~/.config/autostart
or
b) Cheatcode: guiexec=/usr/bin/Script.sh

What is better? What is recommended?

How do I put a .sh on startup? [help]

Posted: 26 Mar 2023, 14:29
by Ed_P
Kulle wrote:
26 Mar 2023, 10:36
What is better?
b) Cheatcode: guiexec=/home/guest/startup.sh

Easier to maintain, as in use or comment out or change to a different file.

How do I put a .sh on startup? [help]

Posted: 28 Mar 2023, 23:46
by Rava
Ed_P wrote:
26 Mar 2023, 14:29
b) Cheatcode: guiexec=/home/guest/startup.sh

Easier to maintain, as in use or comment out or change to a different file.
when you use a rootcopy/ folder then putting the script into rootcopy/home/guest/.config/autostart is as easy to change.
When you not have a rootcopy/ folder, then Ed_P is correct.

How do I put a .sh on startup? [help]

Posted: 29 Mar 2023, 05:39
by Ed_P
Will my approach work with the rootcopy function? Does your approach allow the name of the script to be changed before booting Porteus?

How do I put a .sh on startup? [help]

Posted: 29 Mar 2023, 06:22
by Rava
No and No.


But does your approach allow the changing (as in: creating, editing) of the script prior booting Porteus? No it also does not.

How do I put a .sh on startup? [help]

Posted: 29 Mar 2023, 12:51
by Ed_P
Rava wrote:
29 Mar 2023, 06:22
But does your approach allow the changing (as in: creating, editing) of the script prior booting Porteus?
Yes it does. I boot my ISO and update my scripts on my USB drive before rebooting the drive. ;)

How do I put a .sh on startup? [help]

Posted: 29 Mar 2023, 16:02
by Rava
Ed_P wrote:
29 Mar 2023, 12:51
Rava wrote:
29 Mar 2023, 06:22
But does your approach allow the changing (as in: creating, editing) of the script prior booting Porteus?
Yes it does. I boot my ISO and update my scripts on my USB drive before rebooting the drive. ;)
I wrote: Can you update your script prior booting Port.

Booting Port via ISO is still booting Port. So the correct answer is: no, you cannot change the script without booting Port.

How do I put a .sh on startup? [help]

Posted: 29 Mar 2023, 20:33
by Ed_P
Rava wrote:
29 Mar 2023, 16:02
Booting Port via ISO is still booting Port. So the correct answer is: no, you cannot change the script without booting Port.
Ok but actually I can update it without booting Port or the ISO. I plug the USB stick into my Windows system and add/delete/rename the script that way. NO booting needed. :D