Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Explain this short Cron job

  • 07-08-2015 11:03AM
    #1
    Closed Accounts Posts: 6,075 ✭✭✭


    Can anyone explain to be what this cron job is trying to achieve?
    05,40 15,17,19,21,23 * * * * for f in `ls /home/mydev/my_feeds/`; do [ ! -e /sbcimp/dyn/data/my/uat/feeds/input/$f ] && [ ! -e /sbcimp/dyn/data/my/uat/feeds/processed/$f ] && mv /home/mydev/my_feeds/$f /sbcimp/dyn/data/my/uat/feeds/input/; done
    


Comments

  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    for f in `ls /home/mydev/my_feeds/`; do     
    #for every file in "/home/mydev/my_feeds/" 
    	[ ! -e /sbcimp/dyn/data/my/uat/feeds/input/$f ] \  
    # if there doesn't exist a file of the same name in /sbcimp/dyn/data/my/uat/feeds/input/
    	&& [ ! -e /sbcimp/dyn/data/my/uat/feeds/processed/$f ] \ 
    # nor a file of the same name in /sbcimp/dyn/data/my/uat/feeds/processed/
    	&& mv /home/mydev/my_feeds/$f /sbcimp/dyn/data/my/uat/feeds/input/; 
    # then move the file from /home/mydev/my_feeds/ to  /sbcimp/dyn/data/my/uat/feeds/input/
    done
    
    Returning to the time statement, do this at 05 and 40 past the hours 15,17,19,21,23 every day


  • Closed Accounts Posts: 6,075 ✭✭✭IamtheWalrus


    Fast, accurate and without fuss. Thank you. I'm very grateful.

    One question - does ! -e mean 'does not exist'?


  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    yup, so my overly quick reading of that script requires review ;)


  • Registered Users, Registered Users 2 Posts: 1,127 ✭✭✭smcelhinney


    yup, so my overly quick reading of that script requires review ;)

    Yup, looks good to me. Very succinctly explained.


Advertisement