Announcement

Collapse
No announcement yet.

Startup script does not get executed

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Startup script does not get executed

    Under System Settings -> Startup and shutdown -> Autostart I have set it to run a script file (/home/<myuser>/startup.sh) upon "Startup". But it does not get executed.

    I'm pretty sure the path is correct. The script behaves nicely if I run it from Konsole. I used the same script as startup under KDE 18.04.

    Are there any pitfalls I might be running afoul of? What might I be doing wrong?

    Thanks in advance!

    #2
    It could be a $PATH issue.
    If it is, you can define $PATH at the top of the script or use absolute paths in it.

    Comment


      #3
      I don't get it. My script looks like this:

      Code:
      xbindkeys & qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock &
      (sleep 15s; clementine) &
      (sleep 20s; firefox) &
      (sleep 60s; nice -n 5 ktorrent) &
      Now, xbindkeys DOES autostart, but nothing else does. I suspect that xbindkeys is getting autostarted by something else.

      Should I prefix the commands with /usr/bin/?

      EDIT: Prefixing the commands with /usr/bin/ did nothing.
      Last edited by Spectrum; Feb 22, 2020, 09:37 AM.

      Comment


        #4
        https://docs.kde.org/trunk5/en/kde-w...art/index.html
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          You do have the required #!/bin/bash header at the top pf the script, I assume?


          Code:
          #!/bin/bash 
          xbindkeys & qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock &
          (sleep 15s; clementine) &
          (sleep 20s; firefox) &
          (sleep 60s; nice -n 5 ktorrent) &
          Aaaaand I noticed a probable syntax error. You need two ampersands between commands on your first line, and you don't need one at the ends of any the lines in scripting, at least not here.
          Code:
          xbindkeys && qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock
          A single '&' just puts the command to the left of it into the background, Two is the expected 'and' parameter, running one command after the other, so here the second command is probably not being run at all.

          You could also put each command on its own line, eliminating the need for any ampersands at all.

          Code:
          #!/bin/bash 
          xbindkeys
          qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock
          (sleep 15s; clementine)
          (sleep 20s; firefox)
          (sleep 60s; nice -n 5 ktorrent)
          No idea why it worked in 18.04 vs now, as there have been zero changes to how bash scripting works as far as I can tell. This is not likely a Plasma issue, as the XDG standard is not tied to any desktop, and any script placed in ~/.config/autostart-scripts/ is run, outside of the DE.
          Last edited by claydoh; Feb 22, 2020, 03:25 PM.

          Comment


            #6
            Apart from other issues, instead of sleep 15s; clementine I would use sleep 15s && clementine. Using && requires that the previous sleep be completed before clementine is run. ; doesn't.

            Minor point: Openbox used to require & at the end of a line in its autostart files. But this is from some years ago.

            Code:
            (hsetroot -tile /home/chimak/Dropbox/Backgrounds/gray.png) &
            (sleep 2s && tint2) &
            (sleep 3s && /home/chimak/bin/cpu-usage-alert) &
            (sleep 3s && lxclipboard) &
            (sleep 3s && compton --config /home/chimak/.config/compton.conf -b) &
            (sleep 5s && pkill update-notifier) &
            (sleep 5s && conky) &
            (sleep 5s && udisksctl mount -b /dev/sdb1) &
            (sleep 5s && pkill applet.py) &
            (sleep 5s && pkill light-locker) &
            (sleep 10s && pkill blueman-applet) &
            (sleep 15s && /home/chimak/.dropbox-dist/dropboxd) &
            (sleep 1s && synclient VertEdgeScroll=0) &
            (sleep 1s && synclient RTCornerButton=0) &
            (sleep 1s && synclient RBCornerButton=0) &
            (sleep 1s && synclient LBCornerButton=0) &
            (sleep 1s && synclient LTCornerButton=0) &
            #(sleep 1s && synclient PalmDetect=1) &
            (sleep 25s && /home/chimak/bin/swriter) &
            #last line also has "&" at the end
            Last edited by chimak111; Feb 22, 2020, 10:40 PM.
            Kubuntu 20.04

            Comment


              #7
              Originally posted by claydoh View Post
              You do have the required #!/bin/bash header at the top pf the script, I assume?
              No, I hadn't. I added that now.

              I also deleted the symlink in ~/autostart-scripts/ and recreated it.

              Now it starts working. Hm. I'm not sure what did the trick. Anyway, thanks a lot to everyone for your replies!

              Comment

              Working...
              X