AnsweredAssumed Answered

System script does not work

Question asked by KevinVandenBrande on Feb 5, 2015
Latest reply on Feb 5, 2015 by KevinVandenBrande

Title

System script does not work

Your post

I created the following shell script as test:

#!/bin/bash
folderSource="/Volumes/Macintosh HD/Library/FileMaker Server/Data/Documents/test/"
folderTarget="/Volumes/Macintosh HD/Library/FileMaker Server/Data/Documents/"

cd "$folderSource"

for myFile in *
do
    myPath="$folderSource$myFile"
    mv "$myPath" "$folderTarget"
    if [ "$?" != "0" ]; then
        syslog -s -l notice "Error when moving file $myFile"
    else
        syslog -s -l notice "Moved file $myFile"
    fi
done
# end

This script i placed inside the scripts folder of the FileMaker server. Whenever I create a new systemscript and I execute this script, I always get an error that the move was not successfull. However when i run this script in terminal it works like charm.

What is the cause of this problem? I have tried already many variants of this but without success everytime in the FileMaker server

Outcomes