Site Tools


linux:raspberry:picam:scripts:copyjob

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:raspberry:picam:scripts:copyjob [2015/06/05 15:03] lunetikklinux:raspberry:picam:scripts:copyjob [2019/01/09 18:53] (current) lunetikk
Line 9: Line 9:
 Second create a file named "copyjob.sh" with the code below Second create a file named "copyjob.sh" with the code below
  
-<code sh copyjob.sh>+<code bash copyjob.sh>
 #!/bin/bash #!/bin/bash
 DATE=`date +%d_%m_%Y` DATE=`date +%d_%m_%Y`
Line 36: Line 36:
 </code> </code>
  
-Make sure you use <code>chmod +x cronjob.sh</code> to make it executeable.\\+Make sure you use <code>chmod +x copyjob.sh</code> to make it executeable.\\
 Create a cronjob for it by inserting the following line to the end in<code> vi /etc/crontab</code> <code sh crontab>0 * * * * /records/copyjob.sh >/dev/null 2>&1</code> Create a cronjob for it by inserting the following line to the end in<code> vi /etc/crontab</code> <code sh crontab>0 * * * * /records/copyjob.sh >/dev/null 2>&1</code>
 The job will be executed everytime the clock hits 0 minutes (for example 1:00pm 2.00am...) The job will be executed everytime the clock hits 0 minutes (for example 1:00pm 2.00am...)
 +
 +==== Troubleshooting ====
 +
 +If the copyjob fails because of "too many arguments" its because mv *.jpg extends that command to mv blabla.jpg xyz.jpg etc... Too many files then cause that error because the command is too long. Instead of the mv command above in the script you can use
 +<code bash>
 +find $BASEPATH -name ".jpg" -exec mv {} $NETPATHJPG \;
 +</code> 
 +
 +Like this:
 +
 +<code bash>
 +find $BASEPATH -name ".avi" -exec mv {} $COPYPATH \;
 +sleep 10
 +find $BASEPATH -name ".jpg" -exec mv {} $COPYPATH \;
 +sleep 10
    
 +find $COPYPATH -name ".avi" -exec mv {} $NETPATHAVI \;
 +sleep 10
 +find $COPYPATH -name ".jpg" -exec mv {} $NETPATHJPG \;
 +sleep 10
 +</code>
 +
 +\\
 +\\
 +~~DISCUSSION:closed~~
linux/raspberry/picam/scripts/copyjob.1433509380.txt.gz · Last modified: 2017/03/01 12:50 (external edit)