Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Explain this short Cron job

Options
  • 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 Posts: 1,109 ✭✭✭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 Posts: 1,109 ✭✭✭Skrynesaver


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


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


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

    Yup, looks good to me. Very succinctly explained.


Advertisement