Tidying
This commit is contained in:
parent
93a64b218f
commit
455c987a9f
|
@ -64,13 +64,15 @@ function peertube_import_from_syncthing {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ echo '#!/bin/bash';
|
{ echo '#!/bin/bash';
|
||||||
|
echo '';
|
||||||
|
echo 'LOCKFILE=/root/.peertube.lock';
|
||||||
echo '';
|
echo '';
|
||||||
echo 'if [ -f /root/.peertube.lock ]; then';
|
echo 'if [ -f /root/.peertube.lock ]; then';
|
||||||
echo " lockctr=\$(cat /root/.peertube.lock)";
|
echo " lockctr=\$(cat \$LOCKFILE)";
|
||||||
echo " lockctr=\$((lockctr+1))";
|
echo " lockctr=\$((lockctr+1))";
|
||||||
echo " echo \"\$lockctr\" > /root/.peertube.lock";
|
echo " echo \"\$lockctr\" > \$LOCKFILE";
|
||||||
echo " if [ \$lockctr -ge 30 ]; then";
|
echo " if [ \$lockctr -ge 30 ]; then";
|
||||||
echo " rm /root/.peertube.lock";
|
echo " rm \$LOCKFILE";
|
||||||
echo ' else';
|
echo ' else';
|
||||||
echo ' exit 0';
|
echo ' exit 0';
|
||||||
echo ' fi';
|
echo ' fi';
|
||||||
|
@ -111,22 +113,21 @@ function peertube_import_from_syncthing {
|
||||||
echo '';
|
echo '';
|
||||||
echo 'failed_uploads=0';
|
echo 'failed_uploads=0';
|
||||||
echo '';
|
echo '';
|
||||||
echo 'echo "0" > /root/.peertube.lock';
|
echo "cd ${PEERTUBE_DIR} || exit 32468356";
|
||||||
|
echo "echo \"0\" > \$LOCKFILE";
|
||||||
echo '';
|
echo '';
|
||||||
echo "for video_file in \$search_dir/*; do";
|
echo "for video_file in \$search_dir/*; do";
|
||||||
echo " if [[ \"\$video_file\" == *'.ogv' || \"\$video_file\" == *'.mp4' || \"\$video_file\" == *'.webm' ]]; then";
|
echo " if [[ \"\$video_file\" == *'.ogv' || \"\$video_file\" == *'.mp4' || \"\$video_file\" == *'.webm' ]]; then";
|
||||||
echo " cd ${PEERTUBE_DIR} || exit 32468356";
|
|
||||||
echo " ";
|
|
||||||
echo " if ! grep -q \"\$video_file\" /root/.peertube_uploaded; then";
|
echo " if ! grep -q \"\$video_file\" /root/.peertube_uploaded; then";
|
||||||
echo " peertubetitle=\$(basename \"\$video_file\" | awk -F '.' '{print \$1}' | sed 's|_| |g' | sed 's|-| |g')";
|
echo " peertubetitle=\$(basename \"\$video_file\" | awk -F '.' '{print \$1}' | sed 's|_| |g' | sed 's|-| |g')";
|
||||||
echo " if $nodecmd \$import_script -n \"\$peertubetitle\" \$peertubensfw \$peertubeprivate -u \"\$peertubedomain\" -U \"\$peertubeuser\" --password \"\$peertubepassword\" -f \"\$video_file\"; then";
|
echo " if $nodecmd \$import_script -n \"\$peertubetitle\" \$peertubensfw \$peertubeprivate -u \"\$peertubedomain\" -U \"\$peertubeuser\" --password \"\$peertubepassword\" -f \"\$video_file\"; then";
|
||||||
echo " echo \"\$video_file\" >> /root/.peertube_uploaded";
|
echo " echo \"\$video_file\" >> /root/.peertube_uploaded";
|
||||||
echo ' rm /root/.peertube.lock';
|
echo " rm \$LOCKFILE";
|
||||||
echo " exit 0";
|
echo " exit 0";
|
||||||
echo ' else';
|
echo ' else';
|
||||||
echo " failed_uploads=\$((failed_uploads+1))";
|
echo " failed_uploads=\$((failed_uploads+1))";
|
||||||
echo " if [ \$failed_uploads -gt 1 ]; then";
|
echo " if [ \$failed_uploads -gt 1 ]; then";
|
||||||
echo ' rm /root/.peertube.lock';
|
echo " rm \$LOCKFILE";
|
||||||
echo ' exit 0';
|
echo ' exit 0';
|
||||||
echo ' fi';
|
echo ' fi';
|
||||||
echo ' fi';
|
echo ' fi';
|
||||||
|
@ -134,7 +135,7 @@ function peertube_import_from_syncthing {
|
||||||
echo ' fi';
|
echo ' fi';
|
||||||
echo 'done'; } > /usr/bin/peertubesync
|
echo 'done'; } > /usr/bin/peertubesync
|
||||||
echo '';
|
echo '';
|
||||||
echo 'rm /root/.peertube.lock';
|
echo "rm \$LOCKFILE";
|
||||||
|
|
||||||
chmod +x /usr/bin/peertubesync
|
chmod +x /usr/bin/peertubesync
|
||||||
cron_add_mins 1 /usr/bin/peertubesync
|
cron_add_mins 1 /usr/bin/peertubesync
|
||||||
|
|
Loading…
Reference in New Issue