I'm trying to create a mysqldump of a database via bash script, and automate the process by using Mac's launchd / launchctl process. I can successfully run the bash script manually to backup the db in terminal, but if I try to use launchd, nothing seems to happen.
Anyone know what might be the issue?
Here is the bash script for the mysqldump:
DT=`date +%m_%d_%Y_%H_%M_%S` /Applications/MAMP/Library/bin/mysqldump --opt -u root -proot --host=localhost extrapolation > /Users/[user]/Desktop/db/extrapolation_$DT.sql
and 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"> <dict> <key>Label</key> <string>extrapolation_db_backup</string> <key>ProgramArguments</key> <array> <string>/Users/[user]/Sites/extrapolationlaunch/dbase_backup.sh</string> </array> <key>StartInterval</key> <integer>120</integer> </dict> </plist>
which I've saved in /Users/[user]/Library/LaunchAgents
I then run:
launchctl load ~/Library/LaunchAgents/extrapolation_db_backup.plist`
and if I use
I can see the process:
- 0 extrapolation_db_backup
My guess is maybe some sort of permissions issue but I haven't been able to work it out. Any help would be appreciated.