the script itself looks alright. it could be a timing issue though. the renaming may (for some odd reason) take some time (msec) and if you set the syslog location before the datastore is renamed the command may fail. you could try waiting a bit or move the store rename all the way to the top of the script. also, i'd use a variable to put the hostname in instead of generating it every time you need it. shouldn't matter but makes it more consistent script-wise.