Motion - Feature Request 2006x 06x 06x 123003

Feature Request: Better daemon behaviour

Description

For better and easier handling of Motion with system init scripts, Motion should be able to write a PID file and setuid() to a configured user, if run as root, like other "real" daemons.

-- MagnusHolmgren - 06 Jun 2006

Follow up

Comments

I agree about the PID file thing, I feel it is sorta sloppy to just grap a pid off the process table thus I wrote a patch for this a while back, I'll attach it here.

-- EvilPete - 07 Jul 2006

I've take some lines from your patch and apply to svn 114 , i did some changes as remove the pid file where motion exits , also some checks to avoid problems creating the file ( Permission denied , etc ... ).

-- AngelCarpintero - 10 Oct 2006

On the config part of patch. \n is a valid value for text options. But then it is litterally "\" and followed by "\n". If the config file cannot understand text_left CAMERA 1\nFRONT YARD then I loose an important feature that I use myself.

text_left CAMERA 1\nFRONT YARD

That example writes two lines of text. So \n is a valid value and means new line.

But we should not pick op an actual '\n' as value. It must be the two characters '\' followed by 'n' in the config file to be picked up.

I guess your change is OK for stripping off \n but not '\' 'n'. But you'd better test it.

On PID. I look at your patch. There is one problem. You can start Motion as daemon. And then set it in setup mode via http. Then it continues in daemon but shows the test image in webcam.

But the way you coded it Motion will not remove the PID file when you exit motion from this condition.

pid_file /home/gstreamer/motion.pid is not a good value for the motion-dist.conf

I miss the option of not using a PID file. Maybe it should be default undefined = no PID. And then the /var/run/motion.pid in motion-dist.conf.

Does all newbies and non-techies know what a pid is? Let us call the option process_id_file.

But I am OK adding the feature as such. As long as it is turned off by default if I do not define process_id_file option.

Ok , i followed all your advices and fixes.I've commit already to svn 115.

Closed this feature, if there's any problem open a bug.

-- AngelCarpintero - 10 Oct 2006

I Attachment Action Size Date Who Comment
motion-3.2.6-pid.patchpatch motion-3.2.6-pid.patch manage 2 K 07 Jul 2006 - 12:48 UnknownUser patch so motion creates a pid file ( built for motion-3.2.6 )
patch-pid-svn114EXT patch-pid-svn114 manage 4 K 10 Oct 2006 - 04:15 AngelCarpintero  
Topic revision: r6 - 10 Oct 2006, AngelCarpintero
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.