0

I have a launch agent that I created several years ago to set a random signature both in a .signature and in Mail.app. It does nothing complicated and has hummed along through several OS X versions. However, I see that recently every time it runs there is an error logged into the console:

12/07/15 08:52:36.903 com.apple.xpc.launchd[1]: (local.home.randsig[97440]) Service exited with abnormal code: 1

The script is not at all complicated, and it runs out of my home folder (#HOME/bin/randsig), but I suspect I am running into a sandboxing issue.

#!/bin/bash
SIGHOME="$HOME/.signature"
$HOME/bin/fortune $HOME/mysigs > $SIGHOME

MAIL=`ps -U"$USER" -co command | grep "\bMail\b"`

if [ "$MAIL" ]; then
 cat $SIGHOME | sed -e 's/"/\\"/g' > $HOME/.mail_signature
 MYSIG="$(<$HOME/.mail_signature)"
 osascript <<EOF
      tell application "Mail" to set content of signature "Fortune" to "-- " & return & "$MYSIG"
EOF
fi

The error doesn't prevent the script from running, but since it runs every 12 seconds, the errors do make looking for other things in console more of a problem.

I did see this discussion, but in my case it doesn't help me.

  • Do you really need to run this script 300 times an hour and 7200 times a day? If you slow it down then I would try adding wait and exit 0 at the end of the script. – fd0 Jul 12 '15 at 18:14
  • yes, I do. It changes the signature often enough that successive messages always have different signatures and often enough that if I on’t like the current signature I can easily refresh for a new one without waiting too long. – lbutlr Jul 13 '15 at 3:09

You must log in to answer this question.

Browse other questions tagged .