Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-24-2012, 11:42 PM
|
#1
|
|
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo & Ubuntu
Posts: 243
Rep: 
|
Run GTK UI UDEV
I can run a bash script no problem with udev, but how do I run a GTK UI? I tried the PROGRAM+="/path/to/prog/" and nothing.
I tried calling the program from within a script, still no luck.
So, does anyone know how to do this?
|
|
|
|
05-24-2012, 11:44 PM
|
#2
|
|
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,466
Rep: 
|
Please don't double post. I've reported this thread as a duplicate of this one.
|
|
|
|
05-25-2012, 12:05 AM
|
#3
|
|
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo & Ubuntu
Posts: 243
Original Poster
Rep: 
|
Dude relax, it was an accident. My computer's connection was hanging on load. So, I stopped it, and refreshed. Then clicked post again and it apparently double posted. It's not the end of the world.
Thanks for the help though.
Last edited by amboxer21; 05-25-2012 at 12:06 AM.
|
|
|
|
05-25-2012, 01:03 AM
|
#4
|
|
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo & Ubuntu
Posts: 243
Original Poster
Rep: 
|
Anyhow, here is what I have so far:
Code:
#!/bin/bash
echo "HELLO WORLD" > /home/amboxer/Desktop/hello.txt;
export DISPLAY=:0.0
#su amboxer21 -c 'xhost local:amboxer21;
#PASSWORD=$(zenity --title='Password' --password | sudo -S /home/amboxer21/Documents/warning)
PASSWORD=$(zenity --title='Password' --password)
echo $PASSWORD
if [ $PASSWORD == "password" ]; then
mount /media/Lexar;
else
umount -l /media/Lexar;
fi
I am able to run a C or gtk program with:
Code:
sudo -S /home/annonymous/Documents/warning
I Know that it is extremely sloppy at the moment but it will get fixed up as I go along. Thanks
BTW, Couldn't have done it without you @Nylex! 
Last edited by amboxer21; 05-25-2012 at 01:18 AM.
|
|
|
|
05-25-2012, 01:51 AM
|
#5
|
|
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo & Ubuntu
Posts: 243
Original Poster
Rep: 
|
Anyone, I have
Code:
#!/bin/bash
echo "HELLO WORLD" > /home/amboxer21/Desktop/hello.txt;
export DISPLAY=:0.0
#su amboxer21 -c 'xhost local:amboxer21;
#sudo -S /home/amboxer21/Documents/warning
PASSWORD=$(zenity --title='Password' --password)
echo $PASSWORD;
if [ $PASSWORD == "password" ]; then
sudo -S mount /media/Lexar;
exit 0;
else
PASSWORD=$(zenity --title='Password' --password)
echo $PASSWORD;
fi
It will run properly at first. For example: If I plug in a usb device, a password prompt will pop up. If I enter the correct passwod the first time, it will mount the FS. If I enter the wrong password the first time, then the right password the second time, it will do nothing. How can I fix this?
I feel like I should have something in between my if and else!?
|
|
|
|
05-25-2012, 02:28 AM
|
#6
|
|
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo & Ubuntu
Posts: 243
Original Poster
Rep: 
|
Im trying to run it through a loop
Code:
#!/bin/bash
echo "HELLO WORLD" > /home/amboxer21/Desktop/hello.txt;
export DISPLAY=:0.0
#su amboxer21 -c 'xhost local:amboxer21;
#sudo -S /home/amboxer21/Documents/warning
PASSWORD=$(zenity --title='Password' --password)
echo $PASSWORD;
while true; do
if [ $PASSWORD == "password" ]; then
su -S mount /media/Lexar;
exit 0;
else
PASSWORD=$(zenity --title='Password' --password)
echo $PASSWORD;
fi
done
will infinitely run if password is wrong. If password is right, it exits and does not mount. Unless I type the correct password on the first try.
Last edited by amboxer21; 05-25-2012 at 03:18 AM.
|
|
|
|
05-27-2012, 09:24 AM
|
#7
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,257
|
What you are attempting to do is a poor idea, since udev rules are invoked early in the boot process. At boot time, there is probably no X server running to support your GUI. You could possibly run the GUI on another X server (i.e. on a different host), but there is no guarantee that that server would be available, and it isn't even a sure thing that the network will be alive when some udev rules are invoked.
--- rod.
|
|
|
|
05-27-2012, 09:49 AM
|
#8
|
|
Member
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo & Ubuntu
Posts: 243
Original Poster
Rep: 
|
Yeah, I ran into way too many problems!! More of a headache than it was worth!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
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
|
|
|
All times are GMT -5. The time now is 09:32 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|