DaeMon

Plasma 4 Widgets

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

1
Score 58.0%
Description:

DaeMon is a monitor/start/stop-applet for system-daemons (mysql,bluetooth,cups, etc.) created for ArchLinux-systems

To use it, just set the "polling directory" in the configuration-dialog to a
place where a file for each running daemon is created. In Arch-Linux this is
usually /var/run/daemons. Set the damon-start-scripts-directory to the place
where for each daemon a script exists that excepts the parameters "start" and
"stop" to execute the corresponding actions. In Arch-Linux this is /etc/rc.d.
For other distributions you might have to set a suffix for the files to poll.
Assume that your daemon is "called" cups i.e. and does create a file named
"cups.pid" in the polling directory the you have to enter ".pid" here.
Finally set the polling-interval to a value suitable for you and select the
daemons you would like to monitor/handle using DaeMon.

Since this is my very first plasma-applet and my first python-work for quite
some time I have to apologize for all the errors and imperfections of it. Right
now it is just slightly more than a finger exercise.
Please keep in mind, that I wrote it with an Arch-Linux system in mind, though
it should work for othe distributions as well.

Quite a lot of things can undoubtly be improved and if there is any interest in
the following ideas or if you have something else in mind that could be done,
please let me know.

- give more detailed feedback about the result of a start/stop
- create translations
- create and use a DBUS-service to handle starts und stops of daemons instead
of kdesu

I am always happy about any feedback if somebody really should decide to use
this. ;-)


Have fun!
Last changelog:

10 years ago

0.1 - first try

0.2 - some minor fixes (allow to startup when default polling-directory does not exist, typing-errors)
replaced method of formatting strings to allow running on python < 2.6
added suffix of polling files to configuration dialog

scheffe

10 years ago

Hello,
this applet does not run under kde 4.3.
The traceback from .xsession-errors says following:
Traceback (most recent call last):
File "/usr/share/apps/plasma_scriptengine_python/pyappletscript.py", line 55, in init
self.pyapplet.init()
File "/home/frank/.kde4/share/apps/plasma/plasmoids/DaeMon/contents/code/main.py", line 49, in init
self.initSettings()
File "/home/frank/.kde4/share/apps/plasma/plasmoids/DaeMon/contents/code/main.py", line 166, in initSettings
self.settings["polling_interval"] = int(self.cg.readEntry("polling_interval", "2000").toInt())
TypeError: int() argument must be a string or a number, not 'tuple'
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()

Report

gkrnours

10 years ago

I've some problem with DaeMon under archlinux.
DaeMon display an error icon, and "right click" -> "DaeMon settings" does nothing.

I haven't hacked a lot the source, but gooler trick doesn't do the job. Line around 69 and 80 doesn't seems to be the problem...

Report

MalteDik

10 years ago

hi,

if you just check out /var/run, you might miss some services, see (the most important services have their own subdirs):

$ find /var/run -type f -name "*.pid"
/var/run/console-kit-daemon.pid
/var/run/mysqld/mysqld.pid
/var/run/crond.pid
/var/run/atd.pid
/var/run/cups/cupsd.pid
find: `/var/run/cups/certs': Permission denied
find: `/var/run/hald': Permission denied
/var/run/inetd.pid
/var/run/dirmngr.pid
/var/run/acpid.pid
/var/run/rsyslogd.pid
find: `/var/run/PolicyKit': Permission denied
/var/run/portmap.pid
/var/run/dhclient.wlan0.pid

Report

paulocr

10 years ago

How can I install this plasmoid manually?

I tried with standard instructions from http://www.kde-look.org/help/index.php?type=70&PHPSESSID=c7d3091939a0e62a75d52e53875fc161

but the I get an error from the CMake.

Report

C

tiberiusGER

10 years ago

Hi paulocr,

this is a plasmoid written in python. You do not have to compile it. Just open you "Add Widgets..."-Dialog from your panel (i.e.) and choose "Install New Widgets" .> "Install Widgets From Local File". Select the plasmoid-file you downloaded and it should work.

Make sure you have python, python-kde-bindings and python-plasma-bindings installed.

Also please keep in mind that it (right now) works only on ArchLinux smoothly.

Report

paulocr

10 years ago

Thanks, the problem is I am getting an error in Kubuntu 9.04

I read some forums and other people were getting also errors with other plasmoids so they installed manually. This is the reason why I was asking

Report

gooler

10 years ago

(I'm trying it now under 9.04 which ships python2.6, i'll try later with 8.10 again)

It partially works now, although plasmoids installer warns about installation errors.

To use it, I've entered:
Polling directory:
/var/run
suffix
*.pid

Daemon startup scripts:
/etc/init.d

Selected a few daemons as they are correctly listed, clicked Ok. The selected daemons shows in the plasmoid, all with a + symbol before, but clicking on any of them does nothing.

So a great improvement here :D

Report

C

tiberiusGER

10 years ago

Thanks for trying again and for your patience. Please temove the * from *.pid (just the suffix, no wildcards). Then it should detect the running daemons correctly.
When I click on a listed daemon it opens up kdesu. You do have kdesu available on kubuntu, haven't you?
Maybe it is better to continue working on the via email and ot fill up this page too much (I had nearly overlooked your post). Would you mind contacting me that way? My address in in the readme.txt within the plasmoid-file.

Report

gooler

10 years ago

I've been waiting for a plasmoid like this for a long time. There was an early attempt ( http://blog.ratonred.com/2009/01/a-new-stuff-with-the-power-of-plasma/ also written with Python) but I never get it to work and seems like it's been abandoned.

Now with DaeMon, I've tried to install it in Kubuntu 8.10 amd64 and I get the following error:
"Installing the package DaeMon... failed"

Then it shows in the add component dialog but when you add it to the desktop it shows the following error:
"Could not create a python scriptEngine for the DaeMon widget"
so I went and installed 'python-plasma' package. Then added the widget again and now another error shows:
"Initialization script failed"

Hope this can be of any help.

Report

C

tiberiusGER

10 years ago

Just two more quick thoughts. The error seems to arise from a MessageBox called with a wrong parameter. For now please make sure that the directory

/var/run/daemons

exists, when you add the applet. I will upload a corrected version later today.

I am not at all sure that it works with Kubuntu out of the box though. As I said I will have a look at it.

Since the file is just a zip-file you can open it with Ark (for example) and have a look at the source inside.

Report

billux13

10 years ago

Thank for your interest for kubuntu users :)

I have these following errors in my .xsession-errors :
Traceback (most recent call last):
File "/usr/share/kde4/apps/plasma_scriptengine_python/pyappletscript.py", line 55, in init
self.pyapplet.init()
File "/home/billux/.kde/share/apps/plasma/plasmoids/DaeMon/contents/code/main.py", line 69, in init
header.setText("<font color=\"{color}\">Available Services:</font>".format(color=labelColor))
AttributeError: 'str' object has no attribute 'format'
TypeError: invalid result type from PythonAppletScript.shape()
TypeError: invalid result type from PythonAppletScript.shape()
...

And the directory /var/run/daemons doesn't exist on debian based distro :/

If you want others precisions about kubuntu, don't hesitate to ask me.

Report

C

tiberiusGER

10 years ago

Thank you both for your comments. I do not have an installed Kubuntu available, but I will look into it as soon as possible. Can you see any more messages in your ~/.xsession-errors (hope this exists in Kubuntu)?
I will also add a source package the next few days.

Report

gooler

10 years ago

Wow, triple post, sorry about that :D

Report

gooler

10 years ago

Looking in the xsessions-errors log I've found that most errors come from the use of format() property to give color to the labels: "object has no attribute 'format'"

After removing that calls from the lines 69 and 80 and changing the default daemon polling path to 'var/run' for example in 165 in main.py the plasmoid interface shows in desktop. It doesn't show any daemon, but at least the interface shows.

Now, if you try to configure it, xsessions-errors shows another "object has no attribute 'format'" error that corresponds to #74 in configdaemons.py, removing the format call again makes the configuration dialog work too.

Now, the only thing left is substitute the current format() calls for another that can be applied and know where the daemons can be polled in Debian based distributions.

Hope this helps.

Report

gooler

10 years ago

Looking in the xsessions-errors log I've found that most errors come from the use of format() property to give color to the labels: "object has no attribute 'format'"

After removing that calls from the lines 69 and 80 and changing the default daemon polling path to 'var/run' for example in 165 in main.py the plasmoid interface shows in desktop. It doesn't show any daemon, but at least the interface shows.

Now, if you try to configure it, xsessions-errors shows another "object has no attribute 'format'" error that corresponds to #74 in configdaemons.py, removing the format call again makes the configuration dialog work too.

Now, the only thing left is substitute the current format() calls for another that can be applied and know where the daemons can be polled in Debian based distributions.

Hope this helps.

Report

gooler

10 years ago

Looking in the xsessions-errors log I've found that most errors come from the use of format() property to give color to the labels: "object has no attribute 'format'"

After removing that calls from the lines 69 and 80 and changing the default daemon polling path to 'var/run' for example in 165 in main.py the plasmoid interface shows in desktop. It doesn't show any daemon, but at least the interface shows.

Now, if you try to configure it, xsessions-errors shows another "object has no attribute 'format'" error that corresponds to #74 in configdaemons.py, removing the format call again makes the configuration dialog work too.

Now, the only thing left is substitute the current format() calls for another that can be applied and know where the daemons can be polled in Debian based distributions.

Hope this helps.

Report

gooler

10 years ago

I've been talking in #kde-devel and _Sime pointed out that the format() function that i've been removing only exists in Python 2.6, while i'm currently at 2.5, thats why it fails.

Report

C

tiberiusGER

10 years ago

Thanks for all your information. I just talked to brillux13 about adding a version suitable for python < 2.6. I am also working on finding out how to get the running daemons on debian/?ubuntu. I already have an idea and it should not be difficult to adopt the plasmoid. Do you have a file named xyz.pid for a running daemon xyz in /var/run?

Report

C

tiberiusGER

10 years ago

Thanks for all your information. I just talked to brillux13 about adding a version suitable for python < 2.6. I am also working on finding out how to get the running daemons on debian/?ubuntu. I already have an idea and it should not be difficult to adopt the plasmoid. Do you have a file named xyz.pid for a running daemon xyz in /var/run?

Report

C

tiberiusGER

10 years ago

Thanks for all your information. I just talked to brillux13 about adding a version suitable for python < 2.6. I am also working on finding out how to get the running daemons on debian/?ubuntu. I already have an idea and it should not be difficult to adopt the plasmoid. Do you have a file named xyz.pid for a running daemon xyz in /var/run?

Report

gooler

10 years ago

Yes, there they are.

Also there is a tool called chkconfig that allows to control the services from the command-line, if you want to check its code.

Report

billux13

10 years ago

It's a very good idea to manage services. But I have tested your plasmoid with my kubuntu distro and it doesn't work :( . I have this message when I add the plasmoid :
"Failure of initialisation script".
Could you make a version for this distro ?
And so could you add a link to the plasmoid's sources ? There is only the binary version...

Report

C

tiberiusGER

10 years ago

Please have a look at my reply to the post below...

Report

10 years ago

0.1 - first try

0.2 - some minor fixes (allow to startup when default polling-directory does not exist, typing-errors)
replaced method of formatting strings to allow running on python < 2.6
added suffix of polling files to configuration dialog

12345678910
1
product-maker alem0lars May 30 2011 9 excellent
product-maker Base: 4 x 5.0 Ratings
Emdek
Apr 24 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs ocs-url or ocs-store to install things
Pling
0 Affiliates
Details
license
version
0.2
updated Apr 24 2009
added Apr 21 2009
downloads 24h
0
page views 24h 2