#!/usr/bin/sh
#run full reclone when arguement is given
if [ $# -eq 1 ] 
    then
    echo 'doing long run with all files being updated.'
    #ZE server
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_ze/materials ovh_uk:unloze-uk-bucket/css_ze/materials/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_ze/models ovh_uk:unloze-uk-bucket/css_ze/models/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_ze/sound ovh_uk:unloze-uk-bucket/css_ze/sound/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_ze/maps ovh_uk:unloze-uk-bucket/css_ze/maps/

    #ZR server
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_zr/materials ovh_uk:unloze-uk-bucket/css_zr/materials/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_zr/models ovh_uk:unloze-uk-bucket/css_zr/models/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_zr/sound ovh_uk:unloze-uk-bucket/css_zr/sound/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_zr/maps ovh_uk:unloze-uk-bucket/css_zr/maps/

    #MG server
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_mg/materials ovh_uk:unloze-uk-bucket/css_mg/materials/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_mg/models ovh_uk:unloze-uk-bucket/css_mg/models/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_mg/sound ovh_uk:unloze-uk-bucket/css_mg/sound/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --no-traverse /home/gameservers/fastdl/css_mg/maps ovh_uk:unloze-uk-bucket/css_mg/maps/
    echo 'Finished long run with all files updated.'
#else if no arguement given run default with 30 minute maximum age on files.
else
    echo 'doing short run with files younger than 30 minutes.'
    #ZE server
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_ze/materials ovh_uk:unloze-uk-bucket/css_ze/materials/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_ze/models ovh_uk:unloze-uk-bucket/css_ze/models/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_ze/sound ovh_uk:unloze-uk-bucket/css_ze/sound/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_ze/maps ovh_uk:unloze-uk-bucket/css_ze/maps/

    #ZR server
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_zr/materials ovh_uk:unloze-uk-bucket/css_zr/materials/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_zr/models ovh_uk:unloze-uk-bucket/css_zr/models/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_zr/sound ovh_uk:unloze-uk-bucket/css_zr/sound/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_zr/maps ovh_uk:unloze-uk-bucket/css_zr/maps/

    #MG server
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_mg/materials ovh_uk:unloze-uk-bucket/css_mg/materials/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_mg/models ovh_uk:unloze-uk-bucket/css_mg/models/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_mg/sound ovh_uk:unloze-uk-bucket/css_mg/sound/
    rclone copy --s3-storage-class EXPRESS_ONEZONE --max-age 30m --no-traverse /home/gameservers/fastdl/css_mg/maps ovh_uk:unloze-uk-bucket/css_mg/maps/
    echo 'Finished short run with files younger than 30 minutes.'
fi

