List:Backup« Previous MessageNext Message »
From:VP Date:July 3 2013 5:37pm
Subject:OSX Launchd Initiating Bash Script
View as plain text  
Hiya folks.

So I have this bash script that performs a repair and analyze on a database.  It then does
a mysqldump into a chosen directory.  

When I call this script in the shell, it works just fine.  When launchd calls this script,
the file shows up fine, but the file is empty.  

Any idea why this is happening?  Would it not run it as an administrator?  I realize I'm
running the mysqldump as root however I can change that once I know the script is being
called properly.  

Cheers

(script below)


#!/bin/bash

myFolder='/library/webserver/documents/mydomain/subdirectory/subdirectory2/';
myFile='Databasename'; 
myDate=`date +%Y_%m_%d_%H_%M`;
myOutput=$myFolder$myFile$myDate'.sql';

echo "checking Databasename..."
mysqlcheck Databasename --user=root --password=pathogen --auto-repair --analyze
echo "check done"
echo "Backing up "$myOutput"..."
chmod 700 "$myFolder"
mysqldump --user=root --password=mypassword Databasename > "$myOutput"

echo "Databasename backup done"
# echo $myOutput

exit 0





_____________
Rich in Toronto @ VP





Thread
OSX Launchd Initiating Bash ScriptVP3 Jul
  • Re: OSX Launchd Initiating Bash ScriptVP3 Jul