Run script after boot

Post here if you are a new Porteus member and you're looking for some help.
User avatar
francois
Contributor
Contributor
Posts: 5966
Joined: 28 Dec 2010, 14:25
Distribution: xfce plank porteus nemesis
Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.

Re: Run script after boot

Post#16 by francois » 28 Jan 2015, 03:42

When porteus is booted, what is the output of your script in command line:

Code: Select all

root@porteus:~# /urs/bin/Script.sh
Prendre son temps, profiter de celui qui passe.

beny
Full of knowledge
Full of knowledge
Posts: 963
Joined: 02 Jan 2011, 11:33
Location: italy

Re: Run script after boot

Post#17 by beny » 28 Jan 2015, 21:25

hi brokenman guiexec not work with user script,i have tried in my system and with the autostart panel in settings i can run automatically my tvheadend script,that work in background with xbmc.btw with xfce porteus not

User avatar
brokenman
Site Admin
Site Admin
Posts: 6104
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil
Contact:

Re: Run script after boot

Post#18 by brokenman » 28 Jan 2015, 22:41

Tested twice here (in xfce) with user script and it works fine.

cat /mnt/sda8/dump/test.sh
#!/bin/bash
echo "This is a test" > /tmp/test.txt
chmod +x /mnt/sda8/dump/test.sh

Boot line: guiexec=/mnt/sda8/dump/test.sh

After boot the file /tmp/test.txt exists.
How do i become super user?
Wear your underpants on the outside and put on a cape.

hope
White ninja
White ninja
Posts: 27
Joined: 04 Jul 2020, 12:07
Distribution: porteus 5.0rc1 KDE desktop

Run script after boot

Post#19 by hope » 27 Apr 2021, 13:16

I want to write here although 10 years have passed; since my problem is very similar.

I want to change my Xkeyboard layout to "tr" my script file contains

#!/bin/sh
setxkbmap tr

it is not working. I used cheatcodes "guiexec" by assuming that it is related with X-display environment (gui related...)
Cheatcode correctly find my script file but could not execute above code. What is the problem? Can anybody help?
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.

User avatar
Ed_P
Contributor
Contributor
Posts: 6059
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 & 5.0rc2 Cinnamon 64 ISOs
Location: Western NY, USA

Run script after boot

Post#20 by Ed_P » 27 Apr 2021, 17:05

Does your script execute when you start it manually in terminal? And does the kbmap change?

Have you tried the #!/bin/bash line that brokenman used? And have you made it executable with the chmod command?

When the guiexec cheatcode finds your script and tries to execute it are there any error messages?
Ed

hope
White ninja
White ninja
Posts: 27
Joined: 04 Jul 2020, 12:07
Distribution: porteus 5.0rc1 KDE desktop

Run script after boot

Post#21 by hope » 30 Apr 2021, 11:29

I hoped that changing "sh" to "bash" may work, but nope !
1. How can I see the error it gives during boot? It was so fast that I could not read the error. I tried to see the contents of the files under "/var/log/" folder and I used dmesg but I could not see it...
2. My script only works when I open a terminal after system started. What can be the problem?
3. My script works flawlessly(I did all chmod etc.) and I plugged the energy cable to my computer :lol:
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.

User avatar
Ed_P
Contributor
Contributor
Posts: 6059
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 & 5.0rc2 Cinnamon 64 ISOs
Location: Western NY, USA

Run script after boot

Post#22 by Ed_P » 30 Apr 2021, 15:33

Hi hope.

Can you install a different version of Porteus? Porteus 4.0 is the production version and Porteus 5.0rc2 has many fixes to problems in the 5.0rc1 release candidate version.

If you add a "read" command to the end of your script when it runs it will stop and if there are any error msgs you will have time to read them. Press Enter to continue. An alterative would be to add a "sleep 5" command to the end of your script. Same results as the "read" command but continues automatically after 5 seconds.

For those of us without a tr keyboard is there anything in memory we can check to see if the command works?
Ed

hope
White ninja
White ninja
Posts: 27
Joined: 04 Jul 2020, 12:07
Distribution: porteus 5.0rc1 KDE desktop

Run script after boot

Post#23 by hope » 30 Apr 2021, 17:32

Ok, I tired
1. "debug" cheatcode , no help,
2. try to catch what has written in boot screen : I saw that : ERRORS are

cannot open display "default display"

and

can't open display

3. sorry but "read" command does not work, it didn't stop to read anything.
4. I add a command "setxkbmap tr" at the end of "/etc/rc.d/rc.local" file which should be another way to do the trick, but it didn't work.

In summary :
I only see the errors "cannot open default display" ... the only tip.
I could not start a simple Xkeyboard layout change code in Porteus. I am very sad... :( I can do it manually (i.e. running a simple script file after system started) but if I can do it automatically, why do i put an extra effort?
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.

hope
White ninja
White ninja
Posts: 27
Joined: 04 Jul 2020, 12:07
Distribution: porteus 5.0rc1 KDE desktop

Run script after boot

Post#24 by hope » 30 Apr 2021, 18:05

Ok, I think I found the root cause of the problem I faced in https://bbs.archlinux.org/viewtopic.php?id=155151 explains that, "setxkbmap" command only works in X environment, not in console. Only it works inside X, then it gives "cannot open display" error. Also it says that the I can only use "loadkeys` command to work with them... In openbox gxkb was problematic to load corret TR keyboard. I will try kmap cheatcode with trq option(file referring /usr/share/kbd/keymaps/i386/qwerty/trq.map). Also you can notice that in console you can change keyboard lauyout only with root priviliges. So sodu "loadkeys trq" only works in root shell.

I will use :

kmap=trq

command inside porteus.cfg file as cheatcode. If it does not work, i will use loadkeys as explained in [Solved] kmap=x cheatcode also in textonly console page with "cliexec" cheatcode. I will write the results here.
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.

hope
White ninja
White ninja
Posts: 27
Joined: 04 Jul 2020, 12:07
Distribution: porteus 5.0rc1 KDE desktop

Run script after boot

Post#25 by hope » 30 Apr 2021, 18:45

Ok, my problem was specific one due to "setxkbmap" command in my script only works in X environment. In console, before starting X, it does not work. so put it in a script is useless. I learnt it and I will be careful about any command including "x" character in it I will be more careful when I use it.

cheatcode cliexec=loadkeys~trq works perfect.
Thanks Ed_P for your replies, they will guide me the root cause of the problem I had.
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.

User avatar
Ed_P
Contributor
Contributor
Posts: 6059
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 & 5.0rc2 Cinnamon 64 ISOs
Location: Western NY, USA

Run script after boot

Post#26 by Ed_P » 30 Apr 2021, 18:53

hope wrote:
30 Apr 2021, 17:32
but if I can do it automatically, why do i put an extra effort?
I admire your persistance hope. :punk:

To that end an option you may try. Create a desktop file that executes your script or command. Make it executable, test it, then copy it to /etc/xdg/autostart folder.

rc.local / touchpad problem (Post by Ed_P #60506)
Ed

hope
White ninja
White ninja
Posts: 27
Joined: 04 Jul 2020, 12:07
Distribution: porteus 5.0rc1 KDE desktop

Run script after boot

Post#27 by hope » 01 May 2021, 15:06

Ed_P wrote:
30 Apr 2021, 18:53

To that end an option you may try. Create a desktop file that executes your script or command. Make it executable, test it, then copy it to /etc/xdg/autostart folder.

rc.local / touchpad problem (Post by Ed_P #60506)
Thanks Ed_P, it is an elegant way to solve similar "launch after X" problems. :good:
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.

Post Reply