openSUSE Forums > Applications » How do you create an executable script to run from an icon?

Go Back   openSUSE Forums > Applications
Forums FAQ Members List Search Today's Posts Mark Forums Read


Applications Questions about desktops (KDE, Gnome, XFCE, etc.), software applications (configuration, usage, bugs, documentation)

Reply
Page 2 of 3 1 2 3
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 28-Jun-2009, 14:32
suse_tpx60s's Avatar
Busy Penguin
 
Join Date: May 2009
Location: EU
Posts: 457
suse_tpx60s hasn't been rated much yet
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 11.1 | KDE4.3.3
ASUS
M3N78 | AMD 64x2 5400+ | nvidia 8200+ | 2GB | openSUSE 11.2 | KDE4.3.3
Reply With Quote
  #12 (permalink)  
Old 28-Jun-2009, 14:49
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,913
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #13 (permalink)  
Old 28-Jun-2009, 15:29
suse_tpx60s's Avatar
Busy Penguin
 
Join Date: May 2009
Location: EU
Posts: 457
suse_tpx60s hasn't been rated much yet
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 11.1 | KDE4.3.3
ASUS
M3N78 | AMD 64x2 5400+ | nvidia 8200+ | 2GB | openSUSE 11.2 | KDE4.3.3
Reply With Quote
  #14 (permalink)  
Old 28-Jun-2009, 15:49
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,913
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #15 (permalink)  
Old 29-Jun-2009, 03:03
suse_tpx60s's Avatar
Busy Penguin
 
Join Date: May 2009
Location: EU
Posts: 457
suse_tpx60s hasn't been rated much yet
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 11.1 | KDE4.3.3
ASUS
M3N78 | AMD 64x2 5400+ | nvidia 8200+ | 2GB | openSUSE 11.2 | KDE4.3.3
Reply With Quote
  #16 (permalink)  
Old 29-Jun-2009, 03:58
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,913
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #17 (permalink)  
Old 29-Jun-2009, 04:11
suse_tpx60s's Avatar
Busy Penguin
 
Join Date: May 2009
Location: EU
Posts: 457
suse_tpx60s hasn't been rated much yet
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 11.1 | KDE4.3.3
ASUS
M3N78 | AMD 64x2 5400+ | nvidia 8200+ | 2GB | openSUSE 11.2 | KDE4.3.3
Reply With Quote
  #18 (permalink)  
Old 29-Jun-2009, 04:32
vendetta18's Avatar
Explorer Penguin
 
Join Date: Oct 2008
Location: Pune, India
Posts: 233
vendetta18 hasn't been rated much yet
Send a message via MSN to vendetta18 Send a message via Yahoo to vendetta18 Send a message via Skype™ to vendetta18
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
Reply With Quote
  #19 (permalink)  
Old 29-Jun-2009, 04:40
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,913
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #20 (permalink)  
Old 29-Jun-2009, 04:42
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,913
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
Reply
Page 2 of 3 1 2 3

Bookmarks


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2