Skip to content
Snippets Groups Projects
Commit 455c987a authored by Bob Mottram's avatar Bob Mottram
Browse files

Tidying

parent 93a64b21
No related branches found
No related tags found
No related merge requests found
......@@ -64,13 +64,15 @@ function peertube_import_from_syncthing {
fi
{ echo '#!/bin/bash';
echo '';
echo 'LOCKFILE=/root/.peertube.lock';
echo '';
echo 'if [ -f /root/.peertube.lock ]; then';
echo " lockctr=\$(cat /root/.peertube.lock)";
echo " lockctr=\$(cat \$LOCKFILE)";
echo " lockctr=\$((lockctr+1))";
echo " echo \"\$lockctr\" > /root/.peertube.lock";
echo " echo \"\$lockctr\" > \$LOCKFILE";
echo " if [ \$lockctr -ge 30 ]; then";
echo " rm /root/.peertube.lock";
echo " rm \$LOCKFILE";
echo ' else';
echo ' exit 0';
echo ' fi';
......@@ -111,22 +113,21 @@ function peertube_import_from_syncthing {
echo '';
echo 'failed_uploads=0';
echo '';
echo 'echo "0" > /root/.peertube.lock';
echo "cd ${PEERTUBE_DIR} || exit 32468356";
echo "echo \"0\" > \$LOCKFILE";
echo '';
echo "for video_file in \$search_dir/*; do";
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 " 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 " echo \"\$video_file\" >> /root/.peertube_uploaded";
echo ' rm /root/.peertube.lock';
echo " rm \$LOCKFILE";
echo " exit 0";
echo ' else';
echo " failed_uploads=\$((failed_uploads+1))";
echo " if [ \$failed_uploads -gt 1 ]; then";
echo ' rm /root/.peertube.lock';
echo " rm \$LOCKFILE";
echo ' exit 0';
echo ' fi';
echo ' fi';
......@@ -134,7 +135,7 @@ function peertube_import_from_syncthing {
echo ' fi';
echo 'done'; } > /usr/bin/peertubesync
echo '';
echo 'rm /root/.peertube.lock';
echo "rm \$LOCKFILE";
chmod +x /usr/bin/peertubesync
cron_add_mins 1 /usr/bin/peertubesync
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment