I want to run my “rclone move” command in a script, using CRON. I saw @ajki scripts and tried the upload one.
But it seems it fails because it’s like my script runs many times. And I set only 5 transfers and 10 checkers.
I use a staging folder for all the renames to happen locally before being uploaded. This is my script for moving the staging folder to Amazon Cloud Drive:
#!/bin/bash
ps_out=`ps -ef | grep "rclone move" | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" != "" ]];then
echo "Rclone move is already Running."
else
echo "Rclone move is Not Running. Starting it now..."
rclone move /mnt/user/Media/Staging/ ACDEncrypted:/Media/ --transfers=12 --min-age 1m --stats 15s
fi
exit
You will note that it checks to see if rclone move is running before allowing the move script to run. This makes sure that only one copy of rclone move is running at a time.
I run this once every few minutes via cron jobs on my unraid system.
Also, it’s quick and dirty, but gets the job done. My bash isn’t up to par with some others on here.
@Ajki I c/p your script and this “if pidof …” doesn’t work for me. I just can’t find the scripts name PID. @xyber411 Thanks, i’ll try this one and get back to you ASAP.