I am using the WebScrapbook extension for Firefox in Kubuntu 24.04, which requires running WebScrapbook server in the background. So I created WebScrapbook.sh to do that, and it works just fine. So far so good, right? But then I wanted to put that script into Startup and Shutdown --> Autostart of System Settings, but it doesn't work. I tried adding it as a login script, but it doesn't run. A script file is not an app, but I tried that anyways, but it doesn't run. I created a desktop file and tried running that and still it won't work. So if I can add a script to Autostart, why won't it run the script? Just remember that I can execute the script from the command line, so the problem isn't with my script. How can I make this work as expected?
Announcement
Collapse
No announcement yet.
Autostart not working
Collapse
X
-
What is the command you issue from the CLI?Windows no longer obstructs my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
- Top
- Bottom
-
Try using the full path to the file, or placing it in your $PATH so you don't need to use any path or the "./" is the script marked as executable?
What installation steps did you follow, and what is the actual content of the script you are trying to run?
- Top
- Bottom
Comment
-
Originally posted by claydoh View PostTry using the full path to the file, or placing it in your $PATH so you don't need to use any path or the "./" is the script marked as executable?
What installation steps did you follow, and what is the actual content of the script you are trying to run?export PATH=$PATH:/home/James/py_envs/bin/
cd /home/James/Downloads/WebScrapbook/
wsb serve
That is what I used for Mx Linux with no problem, so are you suggesting that this isn't the way absolute paths are specified in Kubuntu?Last edited by James1234; Mar 07, 2025, 12:09 PM.
- Top
- Bottom
Comment
-
I have no idea what MX uses for creating autostart entries, but in Plasma 6, and iirc later versions of plasma 5.27 use more strict parsing rules. MX's Plasma version will be quite behind this
What are the full contents of the script file? (use code tags if you like)
What happens when you try running it in a terminal?
Code:cd /to/wherever/the/file/is ./Webscrapbook.sh.
Code:#!/bin/bash export PATH=$PATH:/home/James/py_envs/bin/ wsb --root /home/James/Downloads/WebScrapbook/ serve
- #!/bin/bash <---- this is necessary
- export PATH=$PATH:/home/James/py_envs/bin/ <----this adds the dir as a $PATH for bash to find executables (no need for the full path)
- wsb serve --root=/home/James/Downloads/WebScrapbook/ <-- this is what you can use use instead of cd'ing Make sure this is the correct dir for the WebScapbook stuff, and not a subdirectory
Try mine above manually to make sure it is working before trying it as an autostart itemLast edited by claydoh; Mar 08, 2025, 06:56 AM.
- Top
- Bottom
Comment
-
Originally posted by claydoh View PostI have no idea what MX uses for creating autostart entries, but in Plasma 6, and iirc later versions of plasma 5.27 use more strict parsing rules. MX's Plasma version will be quite behind this
What happens when you try running it in a terminal?
Looking at the wsb help page, here is what the script can look like:
Code:#!/bin/bash export PATH=$PATH:/home/James/py_envs/bin/ wsb serve --root=/home/James/Downloads/WebScrapbook/
I suspect cd'ing is the issue, but I am not bash guru
I still can't figure out why won't Kunbuntu Autostart run a simple perfectly working script? Is it an undocumented permissions issue?
- Top
- Bottom
Comment
-
Originally posted by James1234 View PostIt has always worked in the terminal. Was I not clear on that?
Plus just seeking clarity, to be safe.
You never did post the full contents of your script, nor mentioned which desktop you ran in MX, for comparison. For added, since we have no real idea of what you see exactly.
What specific software you installed, from where, and how --granted, you couldn't post links initially-- but some info to start as a baseline as to what you did.
If you have access to MX, look at the relevant .desktop file for your working script in ~/.config/autostart and compare it to the one in Kubuntu.
Different tools may have created different files there? I don't know. Never had an issue adding a script myself.
I doubt it is a permissions thing as this is all done and run at the user level, nothing would have changed unless you ran something with sudo, which doesn't seem likely. There is nothing special about Ubuntu that would be different in this regard from Debian.
Is the script file in the same place as it was when you added it in System Settings? (I just made that mistake in testing)
I added the extension to firefox, and installed PyWebScrapBook, then set up the extension.
It works for me here, with the difference in that I used pipx to install PyWebScrapBook, since I already had that set up. I don't need to export a $PATH or set up any venv since that was already configured. But that difference isn't an issue.
I created my script
Code:#!/bin/bash wsb --root /home/claydoh/Public/WebScrapbook/ serve
I added it in System Settings as an autostart login script, rebooted, and logged out a couple of times and it is working.
Except when I goofed and moved the script out of my Downloads dir. A quick edit fixed that, though.
- Top
- Bottom
Comment
-
Originally posted by claydoh View PostYou never did post the full contents of your script
Originally posted by James1234 View Postexport PATH=$PATH:/home/James/py_envs/bin/
cd /home/James/Downloads/WebScrapbook/
wsb serveOriginally posted by claydoh View Postnor mentioned which desktop you ran in MX, for comparison
Originally posted by claydoh View PostFor added, since we have no real idea of what you see exactly.
Originally posted by claydoh View PostWhat specific software you installed, from where, and how --granted, you couldn't post links initially-- but some info to start as a baseline as to what you did.
Originally posted by claydoh View PostIf you have access to MX, look at the relevant .desktop file for your working script in ~/.config/autostart and compare it to the one in Kubuntu.
Originally posted by claydoh View PostDifferent tools may have created different files there? I don't know. Never had an issue adding a script myself.
I doubt it is a permissions thing as this is all done and run at the user level, nothing would have changed unless you ran something with sudo, which doesn't seem likely. There is nothing special about Ubuntu that would be different in this regard from Debian.
Originally posted by claydoh View PostIs the script file in the same place as it was when you added it in System Settings? (I just made that mistake in testing)
Originally posted by claydoh View PostIt works for me here
- Top
- Bottom
Comment
-
Originally posted by claydoh View PostCode:#!/bin/bash wsb --root /home/claydoh/Public/WebScrapbook/ serve
I suggest you modify your script so it conforms to the syntax shown in his:
Code:#!/bin/bash wsb --root /home/James/Downloads/WebScrapbook/ serve
Windows no longer obstructs my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
- Top
- Bottom
Comment
-
Originally posted by Snowhog View Post
I have no idea what Kubuntu uses to execute it's scripts, but now that you mention it, I came across something I thought was kind of interesting. That is, when I right click on a script in Dolphin, it shows "Open With: Kate", and I thought that should be "Open With: Bash" instead. I didn't change anything because I am too afraid to change anything for something that is supposed to work out of the box, but it seems to me that is an error. Not sure how it got that way (my programmer's editor maybe?) or if that is normal, as in it is ignored outside of the GUI, but it seems it should say "Open With: Bash"?
If none of this still isn't the issue, I will escalate this issue to KDE/Plasma, unless you have any ideas on how to get feedback from Kubuntu on what is wrong, say like a way to view the boot up messages during Autostart?
- Top
- Bottom
Comment
-
... it has been tested for functionality from the command line numerous times...
To diagnose this sort of thing, you can put logging in the script.Regards, John Little
- Top
- Bottom
Comment
-
Originally posted by jlittle View PostThe "environment" being different between autostart and the command line can cause scripts to fail. For example, if wsb communicates with the DE (desktop environment) it will want the dbus session ID.
To diagnose this sort of thing, you can put logging in the script.
But why would this script work from the command line for both Mx Linux and Kubuntu, but it would only work with MX Linux's autostart? As you hinted, there is a difference between these two OS environments is that MX Linux uses svsVinit whereas Kubuntu uses systemd as their init system. I don't know the difference between these two init systems but it's enough to explain (to the experts I consulted) why my script would work in Mx Linux but not in Kubuntu.
In summary I was told that Kubuntu/Systemd requires a "shebang" for Bash to run the script, whereas Mx Linux/sysVinit does not. claydoh and SnowHog both had listed that "command" in their examples, but I left it off because it looked like a comment and not a command, i.e. --
#!/bin/bash
and
## Start PyWebScrapBook pointing at my local folder
both show up in Kate (the default editor for Kubuntu) as comments. I wasn't interested in needless comments so I left them off, but #!/bin/bash is not a comment, it is a command to tell the OS to use bash to run the rest of the script with. Kate editor has very misleading syntax highlighting, but at least everything(?) is working as expected.Last edited by James1234; Mar 11, 2025, 01:41 PM.
- Top
- Bottom
Comment
Comment