You are not logged in.

#1 2024-05-12 21:00

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 428

Issue to autostart script in Konsole

I’m using Q4OS 5 / Plasma and having trouble to autostart scripts at login. These are bash scripts that I need to run in Konsole (they have prompt to wait user interaction) . They seem to run but the Konsole doesn’t show up.

Q4OS 5 was installed a few days ago after recreating new partitions.

To make a test, I’ve created this minimal script

~/script/dummy.sh

#!/bin/bash
echo Hello!
date >> dummy.log
read -p "Press Enter"

Then, using System Configuration > … > Autostart I’ve created a new connection script, and in Advanced Options, I’ve checked Run in a Terminal. This resulted in the creation of this file:

~/.config/autostart/dummy.sh.desktop

[Desktop Entry]
Comment[fr_BE]=
Comment=
Exec=/home/laurent/Script/dummy.sh
GenericName[fr_BE]=
GenericName=
Icon=dialog-scripts
MimeType=
Name[fr_BE]=dummy.sh
Name=dummy.sh
Path=/home/laurent/Script/
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-KDE-AutostartScript=true
X-KDE-SubstituteUID=false
X-KDE-Username=

The script updates the file dummy.log as expected after log-out / log-in but Konsole is not displayed and I don’t see the prompt.

Creating an autostart Application instead of an autostart Login Script makes no difference.

Did I miss something?


Q4OS machines: [Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD] & [Sony Vaio - Pentium P6000 1.87 GHz - 8 GB RAM - 500 GB SSD]

Offline

#2 2024-05-12 21:15

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,351
Website

Re: Issue to autostart script in Konsole

Do you see konsole, if you modify the script this way ?

#!/bin/bash
echo Hello!
date >> dummy.log
sleep 20
read -p "Press Enter"
sleep 20

Offline

#3 2024-05-12 22:26

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 428

Re: Issue to autostart script in Konsole

No, I don't see konsole, but the log file is updated with the correct date/time.

If I double-click on the .desktop file contained in the ~/.config/autostart folder displayed in Dolphin I see konsole, with the prompt and the two 20 s pauses.


Q4OS machines: [Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD] & [Sony Vaio - Pentium P6000 1.87 GHz - 8 GB RAM - 500 GB SSD]

Offline

#4 2024-05-13 07:24

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 428

Re: Issue to autostart script in Konsole

Tried again this morning. The computer has been off the whole night.
If I click on dummy.sh to start it from Dolphin, I don't see konsole, but I see the task in the Task Manager. Obviously waiting Enter to be hit on the keyboard. When I kill the process, Dolphin informs that the process has crashed.

I tested again with this modified version:

#!/bin/bash
date >> dummy.log
sleep 20
read -p "Press Enter to continue"
echo Done! >> dummy.log
sleep 20

The log file contains the word "Done!", but I still don't see konsole. Another issue is that the read command seems to be ignored or bypassed.

This kind of script has always worked without any problem when I was using Plasma 5.20.5 (Q4OS 4). Now I have Plasma 5.27.5 (Q4OS 5).

Last edited by hchiper (2024-05-13 07:58)


Q4OS machines: [Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD] & [Sony Vaio - Pentium P6000 1.87 GHz - 8 GB RAM - 500 GB SSD]

Offline

#5 2024-05-13 10:18

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,351
Website

Re: Issue to autostart script in Konsole

We will check that and post back.

Offline

#6 2024-05-13 16:23

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 428

Re: Issue to autostart script in Konsole

I made some tests. Maybe their results could help.

I booted Q4OS 5 from the same live USB key on two different laptops and with each of them I tested the same 3 following procedures. In each case the results were exactly the same. I believe that hardware problems or install problems can be excluded. Here are the procedures and their results.

0) Copied dummy.sh into /home/adminq and gave 755 permissions

1) From console
- opened a konsole and ran ./dummy.sh
=> got the first delay, then the prompt, and the second delay
=> got both the date and "Done!" in the .log
- deleted the .log

2) From Dolphin
- opened Dolphin and clicked on dummy.sh
=> konsole and prompt not seen
=> didn't hit the keyboard
=> .log created within 1 second with only the date, no "Done!"
- deleted .log
- 2 minutes later:
$ ps -A | grep dummy
   7423 ?        00:00:00 dummy.sh
$ kill 7423
=> Dolphin displays a message informing that the process crashed.

3) Using autostart
- created an autostart login script for dymmy.sh
(there is already a script "50-frst_rsession.sh" and an application "Q4OS Welcome Screen")
- edited the task to check the box "Execute in Terminal"
- logged-off and -in
=> konsole not seen
=> .log created with the date AND "Done!" (as if Enter had been pressed)
- opened the .log in Kate, "Done!" was not present at first, but after a while Kate detected th file has been updated and "Done!" appeared after reload of he file.


Q4OS machines: [Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD] & [Sony Vaio - Pentium P6000 1.87 GHz - 8 GB RAM - 500 GB SSD]

Offline

#7 2024-05-15 11:35

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,351
Website

Re: Issue to autostart script in Konsole

We have performed a few tests and results are consistent with what you observed. In addition we have tested Debian 12 Plasma live media as well, and the results are exactly the same, so we would conclude, autostart script running in terminal doesn't work on Debian 12. It seems to be upstream Debian bug. Moreover we have tested Debian 11 Plasma live media, but the systemsettings > autostart tool doesn't create the .desktop file, but manages to run the script directly on login.

In anyway a workaround is available for Debian-12/Q4OS-5. Edit "~/.config/autostart/dummy.sh.desktop" and modify Exec= line to:

Exec=konsole -e /home/adminu/script/dummy.sh

Now, the terminal window opens on login.

Offline

#8 2024-05-16 08:02

hchiper
Member
From: Belgium
Registered: 2020-07-28
Posts: 428

Re: Issue to autostart script in Konsole

Thanks a lot for your support and for the workaround. It works well.


Q4OS machines: [Samsung R519 - Pentium T4200 2.0 GHz - 4 GB RAM - 500 GB SSD] & [Sony Vaio - Pentium P6000 1.87 GHz - 8 GB RAM - 500 GB SSD]

Offline

Board footer

Powered by FluxBB