Multiple commands in crontab script

Hi forum, i'm not a bash scripter but i have build one. It's all right: cron works fine, rclone works fine ecc...
Now i have a needs: i must sync two b2 bucket and i don't want to duplicate my rclone-cron.sh. So can I add simply the new rclone sync line to my script?

this is the core:

else
        echo -e "rclone starts sync\n"
        /usr/bin/rclone sync /media/store1/ b2:bucket &
        echo $! > "${PIDFILE}"
        chmod 644 "${PIDFILE}"
        fi

In this way
else
echo -e "rclone starts sync\n"
/usr/bin/rclone sync /media/store1/ b2:bucket &
/usr/bin/rclone sync /media/store2/ b2:bucket2 &
echo $! > "${PIDFILE}"
chmod 644 "${PIDFILE}"
fi

Thank you in advance!

hello and welcome to the forum,

yes, you can add multiple rclone sync to a script.
and you can test this yourself using
https://rclone.org/docs/#n-dry-run

1 Like

You'd want to remove the & as that puts it in the background as you don't want that.

Yes, you can run one command than another command without an issue.

1 Like

Thank you for the replies,
Last question: second command runs when first finished or they runs together?

yes, that is correct.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.