Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A psync script that emails status reports' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A psync script that emails status reports
Authored by: stuartlawson on Jun 03, '05 11:37:43AM
I think the code was messed up in the posting process. Don't use the code in the link in the main post. I'll try it again here:

#! /bin/sh
#-------------------------------------------------------------------------
# 2005 Stuart Lawson
# Works in OS X 10.4.1
# This script uses PSYNC
# PSYNC - Copyright 2002 Dan Kogai <dankogai@dan.co.jp>
# psync - 0.69.3  - get version from versiontracker.com
#-------------------------------------------------------------------------

#------- Edit variables here
#-------------------------------------------------------------------------
# User path to be archived
MYFILES="/Users";

# Path to volume where files wil be backed up
MYBACKUP="/Volumes/yourExternalHD/YourBackupFolder";

# Email address to send status report to after PSYNC is done
MYEMAIL="your.name@yourdomain.com";

# Message in email sent when PSYNC fails to run
FAILED="The PSYNC backup did not run because of an error. 
Either the backup external drive is not mounted 
or the file path names have been altered.";
#-------------------------------------------------------------------------

#------- Don't edit below here
#-------------------------------------------------------------------------
/usr/local/bin/psync -d $MYFILES $MYBACKUP >/psyncOut.txt;
if grep -c "copying items" /psyncOut.txt
then
tr '\r' '\n' </psyncOut.txt | grep [[:space:]]items[[:space:]] | mail -s "Backup script ran on ---->  `date`" $MYEMAIL;
rm /psyncOut.txt;
else
echo "$FAILED" | mail -s "Warning: Backup script FAILED on ---->  `date`" $MYEMAIL;
rm /psyncOut.txt;
fi
#-------------------------------------------------------------------------


[ Reply to This | # ]
A psync script that emails status reports
Authored by: demmons65 on Jun 07, '05 08:21:31PM

Is there any Tiger-specific code in this that would prevent it from running on a Panther system? (presuming the same version of psync is installed.)



---
d a v e

http://www.hostwerks.com/~dave/



[ Reply to This | # ]
A psync script that emails status reports
Authored by: adamjohnson on Jun 11, '05 01:35:28PM

I'm curious about this too. Specifically about the 'mail' command, was it available in 10.3?



[ Reply to This | # ]
A psync script that emails status reports
Authored by: stuartlawson on Jun 28, '05 09:49:19AM

I had used it in 10.3 before upgrading o 10.4 and it worked.

If you compare the MAN pages for "mail" in 10.3 and 10.4, "mail" in 10.4 has a few more features, but it works the same in both.




[ Reply to This | # ]