Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: How do you create an executable script to run from an icon?

  1. #11
    Join Date
    May 2009
    Location
    US
    Posts
    867

    Default Re: How do you create an executable script to run from an ic

    Quote Originally Posted by hcvv View Post
    I never would think that you had not tested your scripts first, before trying to make it into a clickable thing. Test it from a console/terminal first!

    So first make your script working.

    BTW it should run as root, so just starting it from a user GUI won't work either. Your command inside the icon should be something like
    Code:
    su /path/to/the/script
    and you must be prepared to enter the root passwd, so I think it must be executed in a console/terminal to give you that change. Or use kdesu.
    Well each individual command in the script works when entered into the console separately. As far as I know the syntax in my script is correct which is why I cannot figure out why it won't work. I even logged in as root to try run it and it didn't make any changes to my charge thresholds.

    I tried Alt-F2 and kdesu /my/path/to/the/script and also nothing.

    I opened the Terminal, did su and password so I'm root. Then entered /my/path/to/the/script and got back an error saying "/bin/sh: bad interpreter: Permission denied"

    I've tried creating the script both as root and as my username but neither work. Totally baffled as it's not making sense.

    I have a similar script working (with different thresholds) in the boot.local without problems So why with this?
    IBM Thinkpad X60s | Intel L2400 | Intel 945GM | 3GB | openSUSE Tumbleweed
    Dell XPS 13 9360 | openSUSE Leap 42.3

  2. #12
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,237

    Default Re: How do you create an executable script to run from an ic

    It can not find the interpreter /bin/sh. And of course will not do anything then.

    In my system /bin/sh is a symbolic link to /bin/bash. I do not know about yours.
    In any case you could change your shebang to
    #!/bin/bash
    because it will use bash in any case and mentioning sh would some give the idea that you wanted to use the Posix shell (or even the Bourne shell).

    Make the change and execute as root to see if the error is gone (and the result you want is achieved).

    boot.local is 'sourced' from the bootscripts, so no shebang needed there (and consequently no error) because it will not be interpreted.
    Henk van Velden

  3. #13
    Join Date
    May 2009
    Location
    US
    Posts
    867

    Default Re: How do you create an executable script to run from an ic

    Well in my system /bin/sh is also a symlink to /bin/bash. I changed #!/bin/sh to #!bin/bash and it made no difference, just get the bad interpretor error again. That is trying to execute it as root from the Terminal.

    I don't know. Something is not right with this.
    IBM Thinkpad X60s | Intel L2400 | Intel 945GM | 3GB | openSUSE Tumbleweed
    Dell XPS 13 9360 | openSUSE Leap 42.3

  4. #14
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,237

    Default Re: How do you create an executable script to run from an ic

    Quote Originally Posted by suse_tpx60s View Post
    Well in my system /bin/sh is also a symlink to /bin/bash. I changed #!/bin/sh to #!bin/bash and it made no difference, just get the bad interpretor error again. That is trying to execute it as root from the Terminal.

    I don't know. Something is not right with this.
    I hope
    Code:
    #!bin/bash
    is a typo in your post, it should be
    Code:
    #!/bin/bash
    BTW, how do you execute as root? This may sound a silly question, but everything I do not realy see may be a misuderstanding between you, me and the system. It should look like:
    Code:
    boven:~ # /path/to/your/script
    when you are loged in as root.
    Henk van Velden

  5. #15
    Join Date
    May 2009
    Location
    US
    Posts
    867

    Default Re: How do you create an executable script to run from an ic

    Yes, sorry it was a typo on my part. It is typed correctly in the script. The frustration was creeping in

    I finally solved it . I moved the script to my home folder and it just started working. Before I had it on another partition that I use for my work files. I don't know why it wouldn't work on the other partition when I was entering the full path to partition and script.

    I'm sorry for wasting your time.
    IBM Thinkpad X60s | Intel L2400 | Intel 945GM | 3GB | openSUSE Tumbleweed
    Dell XPS 13 9360 | openSUSE Leap 42.3

  6. #16
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,237

    Default Re: How do you create an executable script to run from an ic

    You are not wasting my time. We are here as volunteers trying to help each other. When I thought this was time wasting, I would go doing other things

    As this is a root script, the proper place to put it might be in /root/bin/. This is within roots home directory. Roots home directory is at this place, and not within /home, so that it is always there when / is there (and /home maybe not mounted due to problems).

    That other 'not working' partition is that 'a not Linux type' of fs (like Windows one)? (I do not like to leave loose, not understood, problems behind, even if you are satisfied with a now working script).
    Henk van Velden

  7. #17
    Join Date
    May 2009
    Location
    US
    Posts
    867

    Default Re: How do you create an executable script to run from an ic

    The other partition is a Linux ext3 partition I created (which I called /VAULT) which is additional to the standard /, /home, /swap, /boot partitions I have.

    It's on the same physical HDD.

    I'm still getting used to the file system and directory structure in Linux. The only reason I wanted to place the script in the vault partition is that if I ever have to reinstall openSUSE then all my config scripts will be safe and I won't have to go hunting all over for my scripts.
    IBM Thinkpad X60s | Intel L2400 | Intel 945GM | 3GB | openSUSE Tumbleweed
    Dell XPS 13 9360 | openSUSE Leap 42.3

  8. #18

    Default Re: How do you create an executable script to run from an ic

    Quote Originally Posted by suse_tpx60s View Post
    The other partition is a Linux ext3 partition I created (which I called /VAULT) which is additional to the standard /, /home, /swap, /boot partitions I have.

    It's on the same physical HDD.
    It seems you are facing the same problem I did a few months back when I set up my SUSE desktop. I had also added partitions like "/partition_name" and was not able to execute any shell script or C program although I could do that from my home folder. Look into these two threads, hope they help you...
    How to chnage owner from rooot - openSUSE Forums
    Changing Owner Of A Drive, Change owner from root to user - Page 2 - openSUSE Forums

  9. #19
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,237

    Default Re: How do you create an executable script to run from an ic

    Quote Originally Posted by suse_tpx60s View Post
    The other partition is a Linux ext3 partition I created (which I called /VAULT) which is additional to the standard /, /home, /swap, /boot partitions I have.

    It's on the same physical HDD.

    I'm still getting used to the file system and directory structure in Linux. The only reason I wanted to place the script in the vault partition is that if I ever have to reinstall openSUSE then all my config scripts will be safe and I won't have to go hunting all over for my scripts.
    This sounds all very natural and logical. Gives me no idea on why it would not run from there. Sorry.

    Nevertheless some remarks to make you (i hope) more "getting used to ...".
    . Maybe reading SDB:Basics of partitions, filesystems, mount points - openSUSE can help you here.
    . After reading this link it should be clear to you that mounting it at /VAULT is at your own discretion. It could also be mounted at /home/your-uid/vault (most Unix/Linux users are not going for capitals normaly, but again, it is your choice!) or anywhere else within your dierectory tree.
    . It is not /Swap, it is not mounted, it is used as Swap.
    Henk van Velden

  10. #20
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,237

    Default Re: How do you create an executable script to run from an ic

    Just reading vendetta18's post.

    Of course ownership and permission-bits of /VAULT are as important as they are of any directory in the tree leading to your script.
    Henk van Velden

Page 2 of 3 FirstFirst 123 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
  •