SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
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.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a PC openSuSE 12.1 base and X11 installed on it. I use icewm as windowmanager. I wrote some udev rules that finds the attached USB keys, and runs a bash script. That bash script then starts a python script, that implements GUI interface for clamav, with Tkinter. The problem is that, the python script doesn't start clamav_scan. If I run the first bash script from console, everything works perfectly, but if it's started by udev, the clamav_scan doesn't start, but the bash and python script runs.
Is there a special environment, where the udev runs, and this causes the failure? Or what else can be the problem?
try use root privileges in your udev rules. I dont remember how could you use root privileges in udev. Use google. Also take a look at gksudo to use. Maybe you have not sufficient privilege to invoke gui from a scripts.
Thus Do proper actions by graphical root privileges.
I hope it be useful for you.
wow, thanks for the fast replies!
Both of you are true, but my problem is not with the gui. The gui works fine, even if it's called from udev, but the clamav_scan program is not called from python.
So, I plug in my USB key, udev realizes that, successfully starts the first bash script. That script mounts the new drive into a temporary directory, and starts the python script. The python script starts running, the window appears. At this point, the clamav_scan should start, and should scan the directory (the mounted USB key), and should display the results. But this last two steps never happens. Just these last two steps.
If I mount the USB key manually, into the same temporary directory, and I start the bash script also manually, the python window appears, the clamav_scan starts scanning, and in the end, the window displays the results.
Normally, the scanning lasts about 10 seconds (the key has 1 partition, ext3 fs, and 1, 342 byte sized file), and I've already waited for udev to scan the key for half an hour, but it didn't scan.
When I tested the environment set by udev in a script run by udev the PATH was limited. It may be that your bash script is robust against that but the python script is not. It would do no harm to set the envars the scripts depend on in the scripts themselves. At least PATH and DISPLAY. Running env at the command prompt may suggest others.
Maybe catkin s right. but I suggest test your python program whether knowing proper path to look for a device. Also you can use 'findfs' tool to find your device mount point based on UUID or lable. You can pass UUID and mount point of new device as some arguments to your python script. I think there s some issue in your script.