Go script to rsync backup server


Recommended Posts

Can I do the following?

 

Normal startup of unraid, then execute a number of script files then email me the results, then powerdown?

 

The following works from a telnet session when executed one line at a time, but when put in the go script, it fails quickly claiming is it unable to find my script files.

 

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

cd /boot/packages && find . -name '*.auto_install' -type f -print | sort | xargs -n1 sh -c 

cd /boot
/boot/othermounts.sh
/boot/syncdisk4.sh
/boot/syncdisk3.sh
/boot/syncdisk2.sh
/boot/syncdisk1.sh
ssmtp [email protected] < /boot/logs/cronlogs/t1summary.log  
powerdown

 

Here is the snipped of the log file where it is attempting to run the above

 

Oct 16 14:34:50 Tower1 emhttp: shcmd (3): /usr/local/sbin/emhttp_event driver_loaded
Oct 16 14:34:50 Tower1 emhttp_event: driver_loaded
Oct 16 14:34:50 Tower1 init: Re-reading inittab
Oct 16 14:34:50 Tower1 sSMTP[1910]: Unable to locate smtp.gmail.com
Oct 16 14:34:50 Tower1 sSMTP[1910]: Cannot open smtp.gmail.com:587
Oct 16 14:34:50 Tower1 logger: Powerdown initiated
Oct 16 14:34:50 Tower1 rc.unRAID[1914]: Stopping unRAID.

Link to comment

Try adding a delay:

sleep 20

Is DNS set in the webGUI?

those lines indicate you either do not have a nameserver defined, or do not have a network gateway defined.

 

It seems to work with a sleep 60 put in place.  I guess it was just happening too fast.

 

Now, just one more question.  Being a linux noob, I am trying to rename a log file to a system date during a bash script.

 

from rsync.log to 2011_10_14rsync.log or something similar to this.

 

Should I do it in bash, or somewhere else?  Can you suggest a good resource for scripting in bash?

 

Link to comment

There is so much for examples out there that are way beyond my needs, but I might have answered my own question, thanks to this on google.  Tested it and it seems to work.

 

mv t1summary.log "`date +%Y%m%d_%H%M`_t1summary.logarchive"

 

t1summary.log

- becomes -

20111016_2141_t1summary.logarchive

 

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.