This is looking very much like a bug to me.
If someone would care to try and replicate the problem, as I have already done on a second machine, I'd be grateful.
Here's what I did:
Mac OS X 10.7.4
FileMaker Server 12
FileMaker-Server-II:~ fms$ cd /Library/FileMaker\ Server/Data/Scripts/
FileMaker-Server-II:Scripts fms$ cat test.sh
logger "Script runs: $USER"
FileMaker-Server-II:Scripts fms$ ls -la test.sh
-rwxrwxr-x 1 fmserver fmsadmin 51 May 12 11:48 test.sh
FileMaker-Server-II:Scripts fms$ ./test.sh
FileMaker-Server-II:Scripts fms$ cat /var/log/system.log | tail
May 12 12:13:01 FileMaker-Server-II fms: Script runs: fms
I set up two once-only schedules to run test.sh once as default user, the second as fms (which validates).
The default user runs the schedule, fms aborts:
sudo: fmserver : 3 incorrect password attempts ; TTY=unknown ; PWD=/ ; USER=fms ; COMMAND=/Library/FileMaker Server/Data/Scripts/test.sh
I am batteling with another issue and stumbled across your problem. I'm still missing information but this /Library/FileMaker Server/Data/Scripts/backuptofileserver.sh script is it executed by your crontab-shell or by filemaker server ?
From what I have deduced is that it looks like fmserver is not provide with the right credentials to execute test.sh from a command.
I can be totally off but crontab needs to be set in the right user crontab to execute it as that user and the same is true for executing sh-scripts from fmserver. The only difference is that fmserver allows you set the user (and passwd) to execute it with.
The syntax for asking fmserver to do stuff from the commandline is:
fmsadmin -u $1 -p $2 list clients
in which $1 is the user and $2 is the password. List clients is the thing I needed from fmserver.
It's a wide shot hope I sheds some light.