Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Autostart does not work (works ok in openSUSE Leap 15.1)

  1. #1
    Join Date
    Oct 2019
    Location
    Finland
    Posts
    31

    Default Autostart does not work (works ok in openSUSE Leap 15.1)

    I have Creative Gigaworks T20 speakers connected to my Tumbleweed. This speaker has an auto power management feature which complies with energy efficiency regulation required by certain regions (Europe). This means that the speaker will automatically shut off in 10 minutes if no sound is transmitted to the speakers.


    I thought I'd make a little script that plays a little bit of audio and I was cheating on the speaker to stay on. This worked fine in openSUSE Leap 15.1, but will no longer work on Tumbleweed after the upgrade.


    This is my script (wakeup-speakers.sh file)


    while true; do
    mplayer /home/raija/skriptit/creative/20Hz_TestTone2_4.mp3
    sleep 9m
    done


    And it can be found in ~/.config/autostart-scripts. The file itself work ok.


    I can find it in messages (/var/log/) but no error message?
    messages:2020-01-27T00:13:59.910977+02:00 kone3 ksmserver[1640]: ksmserver: Starting autostart script "/home/raija/.config/autostart-scripts/wakeup-speakers.sh"


    How should I change my script or what I should do?





  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,114

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    While this won't help you, because the problem cause is most probably somewhere else, a script should always start with a so called "shebang", that indentifies which interpreter to use. For a bash script this is
    Code:
    #!/bin/bash
    And this should be the first line in your script.

    Also there is an important, but not easy to find feature on the forums.

    Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

    An example is here: Using CODE tags Around your paste.

    In your case, that should have been
    Code:
    cat ~/.config/autostart-script/wakeup-speakers.sh
    which would have spared you a lot of typing because the path to the file is clear then without doubt (or typing errors).
    Henk van Velden

  3. #3
    Join Date
    Oct 2019
    Location
    Finland
    Posts
    31

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Thank you for your advices. I try to make myself as clear as possible but I failed.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,114

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Quote Originally Posted by RaijaR View Post
    Thank you for your advices. I try to make myself as clear as possible but I failed.
    You did not realy fail, I think your question is clear enough and also documented. I only gave some general advice for the future.

    I hope that others (specialy TW users, I am not one) will soon come to help you.
    Henk van Velden

  5. #5
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,262

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Quote Originally Posted by RaijaR View Post
    How should I change my script or what I should do?
    I just ran a quick test on my Tumbleweed machine The while loop runs as expected while the user is logged into a Plasma5 session.
    Did you remember to make the scriot executable?


    Code:
    sysman@iMac-testing:~> cat /etc/os-release |grep -i "# ver"
    # VERSION="20200124"
    
    sysman@iMac-testing:~> lh .config/autostart-scripts/while-test
    -rwxr--r-- 1 sysman wheel 81 Jan 28 11:52 .config/autostart-scripts/while-test
    
    sysman@iMac-testing:~> cat .config/autostart-scripts/while-test
    #! /bin/dash
    while true; do
    touch /home/sysman/tmp/while-test.out
    sleep 1m
    done
    
    sysman@iMac-testing:~> lh ~/tmp/
    total 0
    drwxr-xr-x 1 sysman wheel  98 Jan 28 11:55 .
    drwxr-xr-x 1 sysman wheel 558 Jan 28 11:55 ..
    drwxr-xr-x 1 sysman wheel   0 Jan 25 13:09 anæsthesia
    drwxr-xr-x 1 sysman wheel  16 Jan 24 09:45 déjà
    drwxr-xr-x 1 sysman wheel   0 Jan 25 13:10 slàinte-mhath
    drwxr-xr-x 1 sysman wheel  16 Jan 24 10:24 test
    -rw-r--r-- 1 sysman wheel   0 Jan 28 12:06 while-test.out
    
    sysman@iMac-testing:~> date
    Tue 28 Jan 12:07:12 GMT 2020
     
    sysman@iMac-testing:~>
    --
    slàinte mhath,
    rayH

    ~ knowing the right answer is easier than knowing the right question.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,114

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Quote Originally Posted by eng-int View Post

    Code:
    #! /bin/dash
    dash? .
    Henk van Velden

  7. #7
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,262

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Quote Originally Posted by hcvv View Post
    dash? .
    The dash shell is like a junior bash. It has a much smaller footprint and 90% of the capability. I started using it when there was a security threat with bash a few years ago. As far as I can tell all dash scripts run unaltered in bash.
    --
    slàinte mhath,
    rayH

    ~ knowing the right answer is easier than knowing the right question.

  8. #8
    Join Date
    Oct 2019
    Location
    Finland
    Posts
    31

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    I wasted half an hour searching the dash command on the internet.
    But I managed to get the script work. And the reason was really simple, wrong file protection.

    Code:
    raija@kone3:~/skriptit/creative> cat wakeup-speakers.sh  
    #! /bin/bash
    while true; do
        mplayer /home/raija/skriptit/creative/30Hz_TestTone2_4.mp3
        sleep 9m
    done
    raija@kone3:~/skriptit/creative> la 30*.mp3              
    -rwxrwxr-x 1 raija users 69579 26. 9. 14:36 30Hz_TestTone2_4.mp3
    -rw-r--r-- 1 raija users 37547 12. 8. 14:09 30Hz_TestTone3_2.mp3 <-- kääk!
    raija@kone3:~/skriptit/creative> 
    
    Both MP3 files were done at the same time with Audacity. I change the 30Hz_TestTone2_4.mp3 with chmod command.

  9. #9
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,722
    Blog Entries
    2

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Quibbling and may not be required,
    Ordinarily before a conditional statement like while is to be run,
    Typically I find that the variable to be tested needs to be instantiated and set to an initial value.
    Otherwise, although in most cases the value might be what is desired there is no guarantee that'd be so.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  10. #10
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,262

    Default Re: Autostart does not work (works ok in openSUSE Leap 15.1)

    Quote Originally Posted by tsu2 View Post
    Quibbling and may not be required,
    Ordinarily before a conditional statement like while is to be run,
    Typically I find that the variable to be tested needs to be instantiated and set to an initial value.
    Otherwise, although in most cases the value might be what is desired there is no guarantee that'd be so.
    With “while true” I thought that the condition was the existence of the loop itself. That would be set by calling (running) the script.

    What puzzles me (and I want to test later) is the apparent requirement for a sound file to be executable when fed to a player from a script.
    --
    slàinte mhath,
    rayH

    ~ knowing the right answer is easier than knowing the right question.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •