 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

23rd January 2008, 01:51 PM
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 114

|
|
|
Entering su password in a script
my script needs to be ran as root. In the script i have su to change to root but how do i say what the password is, in the script...i.e. automatically enter the root password?
or at least once the root password has been entered, continue with the rest of the script.
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."
After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
|

23rd January 2008, 01:58 PM
|
 |
Retired Again - Administrator
|
|
Join Date: Nov 2007
Location: Reality
Posts: 3,034

|
|
Probably best to use 'sudo' instead and add the scripts and/or commands to the /etc/sudoers file.
See my example in this thread to give you an idea.
Sudo scripts
__________________
.
Marching to the beat of his own conundrum.
|

23rd January 2008, 02:03 PM
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 114

|
|
thanks a lot
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."
After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
|

23rd January 2008, 02:43 PM
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 114

|
|
|
Ok. I have a script which imply pings google (im lazy, i cant be bothered to open a terminaal then manually ping it). The script works fine, apart from when i add it to a custom application launcher, it does not work.
When i double click the script, it asks me how i want to open it (run in terminal, display, cancel run), even though i have checked the box to make it an executable and said i want it to open in the gnome terminal (Properties > Open with > Add > Use custom command. The custom command i use is gnome-terminal which is the correct command to run the gnome terminal.)
Does anybody know how to make a script open in the terminal, once you have added it to a custom launcher on the taskbar?
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."
After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
|

23rd January 2008, 02:59 PM
|
 |
Retired Again - Administrator
|
|
Join Date: Nov 2007
Location: Reality
Posts: 3,034

|
|
|
Did you read the whole example, including Step 3?
__________________
.
Marching to the beat of his own conundrum.
|

23rd January 2008, 03:04 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Posts: 2,008

|
|
|
gnome-terminal -e or -x should work, doesn't seem to work for me.....
|

23rd January 2008, 03:08 PM
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 114

|
|
yes i did. I tried adding sudo at the start of the command but that did not do anything.
I thought of this but it does not run the ping, nor does it change the directory, it only opens the terminal.
Code:
gnome-terminal
cd /home/Antonio/documents/misc/scripts
ping.sh
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."
After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
|

23rd January 2008, 03:18 PM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 741

|
|
|
you should look at these as batch files, it does step one, when it gets an exit or completesignal it moves on
you first tell it to run gnome-terminal, it does that but since it it still running it won't move down the ladder to the next commands
it might be better to implement it in your ping.sh and then call that in a terminal
__________________
LINUX NUMBER 389596
machine number 290131
|

23rd January 2008, 03:19 PM
|
 |
Retired Again - Administrator
|
|
Join Date: Nov 2007
Location: Reality
Posts: 3,034

|
|
|
If I read you right, you're trying to open terminal within the script? You don't need this - just the guts of the script (as if you were typing it in a terminal that's already open).
"sudo" is for scripts (or other commands) to be run as root. There must be a corresponding entry in /etc/sudoers.
Did you select type "Application in Terminal" in the launcher properties?
So, the basic steps:
1. Create the script, put it somewhere accessible, make it executable/SELinux-compliant
2. If run as root, add to sudoers
3. Create launcher to run the script (and only the script), add sudo only if a root script
__________________
.
Marching to the beat of his own conundrum.
|

23rd January 2008, 08:51 PM
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 114

|
|
thanks for the info people 
gnome-terminal -e or -x does not work.
I have it working now though. Thanks for all your help guys
One more question....the icons are .svg files? does anybody know of any good sites for these? or where i can find them on my system apart from the limited supply in:
/usr/share/icons/hicolor/scalable/apps/gnome-panel-launcher.svg
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."
After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
|

23rd January 2008, 09:08 PM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 741

|
|
well firstly, post your solution so others can be helped from it to
secondly, try Gimp for saving something in a different format, there is a chance it will allow for svg, if not, try yum search svg or something like that
__________________
LINUX NUMBER 389596
machine number 290131
|

23rd January 2008, 09:12 PM
|
|
Guest
|
|
Posts: n/a

|
|
|
What do you mean by "gnome-terminal -e or -x does not work."?
|

23rd January 2008, 09:59 PM
|
|
Registered User
|
|
Join Date: Dec 2007
Posts: 114

|
|
|
sej7278 sugessted it
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."
After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
|

23rd January 2008, 10:33 PM
|
 |
Registered User
|
|
Join Date: Dec 2007
Location: Wisconsin
Posts: 196

|
|
You can also use PNG files as icons .. possibly even others. There are other icons in /usr/share/pixmaps and /usr/share/icons (and its sub-folders). Probably other places as well.
__________________
So dawn goes down to day,
Nothing gold can stay.
|

23rd January 2008, 10:36 PM
|
|
Guest
|
|
Posts: n/a

|
|
I know. When you said that it does not work, what did you try?
For example, both
Code:
gnome-terminal --working-directory /tmp -x ping www.google.com
or
Code:
gnome-terminal -e "sh -c 'cd /tmp;ping www.google.com'"
work, AFAICT.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 07:39 (Monday, 20-05-2013)
|
|
 |
 |
 |
 |
|
|