In Mojave, I'm running a script as a daemon to call a program I've written - located in /Library/Daemons - and which runs every 7 mins. The program "my app" accesses local files does system calls to other machines (like ssh and scp).
Here is the .plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

The program runs perfectly under my_username, but does not run correctly under launchd. Here is the script:

echo "  "  >> "$1"
echo "Power Grab started on:" >> "$1"
cd /Users/my_username/PG1
echo "The dir is:" >> "$1"
pwd >> "$1"
date >> "$1"
whoami >> "$1"
./myapp > /Users/juanorodriguez/Desktop/PG1/myapp.out 2>&1
echo "Myapp complete on:" >> "$1"
date  >> "$1"
echo " "  >> "$1"

I can see the initial script called by launchd and can see it running as my_username by invoking whoami.

You must log in to answer this question.

Browse other questions tagged .