Some shell scripting help needed (Linux) *solved*

jibbajabbajibbajabba Member Posts: 4,317 ■■■■■■■■□□
All our Linux server obviously run daily backups.
A NFS share is mounted to /backup and the daily backups are saved in /backup/Mon ; /backup/ Tue and so on.

Our own backup scripts we use just tars up folder xyz and writes a log called backup.log.

Now Acronis on the other hand, writes its logfiles in

/etc/Acronis/TrueImage/Logs/

They looks something like :

Feb_6__2009_9_09_33_AM.log

Trouble is now. We have a "sanity" server running which checks every server's backup.log to ensure the backup did at least run and whether it was successful or not.

What we did with Acronis first was configuring a post-command moving the logfile to /backup and rename it accordingly. This however doesn't work for Incremental or Differential Acronis tasks as it requires that particular logfile.

Now is there a way to write a shell script which checks the current date and 'copies' rather than moving the file into a new location ?

So the script checks for example the current date

# date
Fri Feb 6 09:13:29 GMT 2009

and based on the output it knows it must copy only

Feb_6__2009_9_09_33_AM.log

to /backup/Fri etc.

?

I hope it makes sense ...

Btw., the script doesn't have to know whether to put it in /backup/Mon or /backup/Tue etc., as the Acronis server normally have a task setup for each day to retain a 7-day rotation.

Any help is highly appreciate it ...
My own knowledge base made public: http://open902.com :p

Comments

  • jibbajabbajibbajabba Member Posts: 4,317 ■■■■■■■■□□
    Mmmm... it appears that it does actually still work, it simply cannot send the logile as the post-command is invoked before the mail has been send out.
     completed successfully.
    Description : Create Full Backup Archive
    From:	sda
    To file:	"/backup/Fri/Friday.tib"
    Compression:	Normal
    Cannot read the log file
    

    Mmm...

    Ah well, still, if someone has an idea - shoot :)
    My own knowledge base made public: http://open902.com :p
  • jibbajabbajibbajabba Member Posts: 4,317 ■■■■■■■■□□
    Think I just googled it myself correctly
    writelog()
    {
    text=$1
    echo `date +%T` $text >> $LOG
    }
    TODAY_DATE=`date +%d%m%Y`
    TODAY_DAY=`date +%a`
    LOG=/backup/$TODAY_DAY/backup.log
    
    trueimagecmd --create --harddisk:1 --filename:/backup/$TODAY_DAY/backup.tib 2>>$LOG
    

    Something along those lines will do ... Just gonna run the Acronis job through trueimagecmd rather than the UI ...
    My own knowledge base made public: http://open902.com :p
Sign In or Register to comment.