[SOLVED] 'motion' web camera software sort of stopped working till I moved 17,000 files?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
they may help you --
off the top of my head without watching these vids. I'd do this with your script.
Code:
#!/bin/bash
echo "foo"
#pkill motion
Log_File="/where/ever/you/want/it/LogFile.log"
Images1=/home/scott/testmotion/motion-files
Move_Images_to="/home/scott/testmotion/motion-files"
Test_folder=/home/scott/testmotion/motion-files
#put a counter in it to split up your images dir a little more?
Runcount=1
while [[ true ]]
do
#inside loop to get updated with each pass.
Date="$(date +%F-%H:%M:%S)"
#only increment it in the first line so it matches in
# second line.
mkdir -pv "$Move_Images_to-$((Runcount++))-$Date" >> $Log_File
mv -v "$Images1" "$Move_Images_to-$Runcount-$Date" >> $Log_File
mkdir -pv "$Test_folder" >> $Log_File
#shut down motion how ever it gets shut down
#and remove PID
rm /path/to/PID
sleep 60
or whatever time one wants.
then call to restart after sleep.
you dir are already set up for it.
#restart motion
motion -c /path/to/config/file
done
I got a say whoever wrote this didn't think far enough past his nose to think someone would want to start, stop, and maybe even pause this application and code it to allow it to be done. making this process a lot easier.
note that is not a completely working script, just an Idea ...
this just shows how the log file looks, maybe redundant or over kill in what you are doing but might come in handy.
Code:
userx%slackwhere ⚡ ~ ⚡> mkdir -vp my/test/dir/ > testLog
userx%slackwhere ⚡ ~ ⚡> cat testLog
mkdir: created directory 'my'
mkdir: created directory 'my/test'
mkdir: created directory 'my/test/dir/'
userx%slackwhere ⚡ ~ ⚡> cd my
userx%slackwhere ⚡ my ⚡> ls
test
userx%slackwhere ⚡ my ⚡> cd test
userx%slackwhere ⚡ test ⚡> ls
dir
userx%slackwhere ⚡ test ⚡>
MOD: hours later I see its been marked solved, so .. goody -- now you can be a spy master.
Thanks for looking at this.
It does not seem to be a problem, my script with not stopping motion and renaming dirs while it is running.
You said this
#shut down motion however it gets shut down
#and remove PID
That is a good question, how to stop it, If anyone knows, could they tell me exactly how?
using 'pkill motion' terminates the script, so must be an error?
but it does kill motion running from a terminal.
gap integer
Values: 0 - 2147483647 / Default: 60
Gap is the seconds of no motion detection that triggers the end of an event.
An event is defined as a series of motion images taken within a short timeframe.
ffmpeg_timelapse boolean
Values: 0 - 2147483647 / Default: 0 (disabled)
Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used.
ffmpeg_timelapse_mode discrete strings
Values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual / Default: daily
The file rollover mode of the timelapse video.
on_event_end string
Values: Max 4095 characters / Default: Not defined
Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use Conversion Specifiers and spaces as part of the command.
if on_event_end do whatever it does,
I wish I had a camera to play with to figure it out so I could code and see what does what. but I think it does not turn off per se' but it looks like you can put it into a rest period using them config commands.
You use a combination of the Motion remote control and the Linux cron daemon which all
Linux systems have. Let us take the example that we want to enable motion detection at
9:00 in the morning and turn it off at 18:00. Motion 3.1 must be built with xmlrpc. If
you use 3.2 Motion is remote controlled using a browser.
From motion 3.2 there is no longer a motion-control program.
Instead you use a program that can fetch a webpage. We simply
just throw away the html page that Motion returns.
Programs commonly available on Linux machines are wget and lwp-request.
gap integer
Values: 0 - 2147483647 / Default: 60
Gap is the seconds of no motion detection that triggers the end of an event.
An event is defined as a series of motion images taken within a short timeframe.
ffmpeg_timelapse boolean
Values: 0 - 2147483647 / Default: 0 (disabled)
Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used.
ffmpeg_timelapse_mode discrete strings
Values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual / Default: daily
The file rollover mode of the timelapse video.
on_event_end string
Values: Max 4095 characters / Default: Not defined
Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use Conversion Specifiers and spaces as part of the command.
if on_event_end do whatever it does,
I wish I had a camera to play with to figure it out so I could code and see what does what. but I think it does not turn off per se' but it looks like you can put it into a rest period using them config commands.
Interesting idea, use crontab to pause motion, then use it to start motion.
I set my chron -e to run my script at midnight
So could the pause line pause motion at 23:59 ?
then cron runs my script, my script includes starting motion so would not need to use the resume
Alternatively, could my script execute the crontab command in itself, written into the script to pause motion??
Thing is I see 'root' in there, so I assume it can not.
Right now for testing, my script run every hour. Can that pause command be told to run one minute before every hour just for testing purposes?
So far the script has not caused a failure of motion, even though motion is not stopped, killed, or paused, so dont know how important to pause motion.
And at night, no advantage to pause motion as it is so dark, the camera can see any motion anyway. But if someone came by with a light, then motion is running and will record pics. https://help.ubuntu.com/community/CronHowto
Last edited by sdowney717; 07-06-2017 at 12:52 PM.
Interesting idea, use crontab to pause motion, then use it to start motion.
I set my chron -e to run my script at midnight
So could the pause line pause motion at 23:59 ?
then cron runs my script, my script includes starting motion so would not need to use the resume
Alternatively, could my script execute the crontab command in itself, written into the script to pause motion??
Thing is I see 'root' in there, so I assume it can not.
Right now for testing, my script run every hour. Can that pause command be told to run one minute before every hour just for testing purposes?
So far the script has not caused a failure of motion, even though motion is not stopped, killed, or paused, so dont know how important to pause motion.
And at night, no advantage to pause motion as it is so dark, the camera can see any motion anyway. But if someone came by with a light, then motion is running and will record pics.
I do not use cron or motion so I have no real world experience in this matters but that too is why it is called testing mode.
I'd keep what you have and put it somewhere safe then start anew rethink how to by using how or the logic that is used for motion, which is it whence on it stays on and just pauses between takes, then try cron without root. first.
you've already got a user attached to the group yes? or how ever you set that part up already.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.