Script to synch, then shutdown?

What exactly is your issue? Does it never shut down?

Please explain as detailed as possible. Thank you.