unMenu user Scripts - echo commands don't provide feedback on running script


Recommended Posts

Added a User script to sync 2 servers together via rsync which works fine in a putty window.  It works with unMenu, but doesn't provide real time updates (via the echo commands) like a bash script does.  It seems like unmenu locks up while the script is running (which can take several hours).  At the very end of the run it give me:

 

Starting Sync to Server1 mounts to t2 and s1 set up Sat May 12 09:29:10 MDT 2012 ====== moving to Disk1 =========== Sat May 12 09:49:26 MDT 2012 ====== moving to Disk2 =========== Sat May 12 10:01:06 MDT 2012 ====== moving to Disk3 =========== Sat May 12 10:09:18 MDT 2012 ====== moving to Disk4 =========== Sat May 12 10:55:32 MDT 2012

 

Is there any way for the script to provide feedback while its running so it doesn't appear to have locked up?  I'm guessing that echo commands are not the correct way??

 

Here is the script

 

#define USER_SCRIPT_LABEL Sync to Server1
#define USER_SCRIPT_DESCR Once the server is up this should work.  Start the array first. 
#UNMENU_RELEASE $Revision: 7 $ $Date: 2010-03-29 23:12:23 -0400 (Mon, 29 Mar 2010) $
echo "Starting Sync to Server1"
cd /boot
# Backup from production server to 2nd level backup and log results
# version .11

# Set up email header
cd /boot
echo To: [email protected] >> /boot/logs/cronlogs/t1summary.log
echo From: [email protected] >> /boot/logs/cronlogs/t1summary.log
echo Subject: Tower1 rsync summary >> /boot/logs/cronlogs/t1summary.log
echo   >> /boot/logs/cronlogs/t1summary.log
echo Log of rSync backup >> /boot/logs/cronlogs/t1summary.log

# Set up mounts
cd /boot
othermounts.sh

echo ++ >> /boot/logs/cronlogs/t1summary.log
echo ++++++ starting backup now ++++++++++ >> /boot/logs/cronlogs/t1summary.log
echo ++ >> /boot/logs/cronlogs/t1summary.log
# Backup Disk 1
echo ++++++  >> /boot/logs/cronlogs/t1disk1.log
echo ++++++ starting daily cron now ++++++++++ >> /boot/logs/cronlogs/t1disk1.log
echo ++++++  >> /boot/logs/cronlogs/t1disk1.log
date
echo ====== moving to Disk1 ===========
echo ====== moving to Disk1 =========== >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk1.log

rsync -av --stats --progress /mnt/s1disk1/ /mnt/disk1/  >> /boot/logs/cronlogs/t1disk1.log

date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk1.log

echo == >> /boot/logs/cronlogs/t1summary.log
echo ====== ending daily cron now Disk1 =========== >> /boot/logs/cronlogs/t1summary.log
echo == >> /boot/logs/cronlogs/t1summary.log

# Backup Disk 2
echo ++++++  >> /boot/logs/cronlogs/t1disk2.log
date
echo ====== moving to Disk2 ===========
echo ====== moving to disk2 =========== >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk2.log

rsync -av --stats --progress /mnt/s1disk2/ /mnt/disk2/  >> /boot/logs/cronlogs/t1disk2.log

date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk2.log

echo == >> /boot/logs/cronlogs/t1summary.log
echo ====== ending daily cron now Disk2 =========== >> /boot/logs/cronlogs/t1summary.log
echo == >> /boot/logs/cronlogs/t1summary.log

# Backup Disk 3
echo ++++++  >> /boot/logs/cronlogs/t1disk3.log
date
echo ====== moving to Disk3 ===========
echo ====== moving to disk3 =========== >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk3.log

rsync -av --stats --progress /mnt/s1disk3/ /mnt/disk3/  >> /boot/logs/cronlogs/t1disk3.log

date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk3.log

echo == >> /boot/logs/cronlogs/t1summary.log
echo ====== ending daily cron now disk3 =========== >> /boot/logs/cronlogs/t1summary.log
echo == >> /boot/logs/cronlogs/t1summary.log

# Backup Disk 4
echo ++++++  >> /boot/logs/cronlogs/t1disk4.log
date
echo ====== moving to Disk4 ===========
echo ====== moving to disk4 =========== >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk4.log

rsync -av --stats --progress /mnt/s1disk4/ /mnt/disk4/  >> /boot/logs/cronlogs/t1disk4.log

date >> /boot/logs/cronlogs/t1summary.log
date >> /boot/logs/cronlogs/t1disk4.log

echo == >> /boot/logs/cronlogs/t1summary.log
echo ====== ending daily cron now disk4 =========== >> /boot/logs/cronlogs/t1summary.log
echo == >> /boot/logs/cronlogs/t1summary.log
date

# Send email of summary of results
ssmtp [email protected] < /boot/logs/cronlogs/t1summary.log
cd /boot/logs/cronlogs  
mv t1summary.log "`date +%Y%m%d_%H%M`_t1summary.logarchive"

Link to comment

unMenu waits for the entire stream to finish.

 

You may be able to get it to work... but doing it through unMenu is probably not the correct approach.

 

The only thing i can think of that might work is to echo the progress to the syslog (kind of like i do with my unMenu packages) and then load up the myMain or main unMenu page that refreshes every minute or so.

Link to comment

unMenu waits for the entire stream to finish.  You may be able to get it to work... but doing it through unMenu is probably not the correct approach.

 

Oh Well, it was worth a try.  It notifies me by email that everything went fine.  I suppose that is good enough....

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.