Topic: filetool.sh hack
started by: spark-o-matic
Posted by spark-o-matic on Oct. 09 2008,23:18Hi all,
I finaly did what I threatened to do and hacked filetool.sh so I can backup using the default backup.tar.gz or backup_(name).tar.gz from the command line. These are the changes I made.
In Beaver I did a replace of all instances of backup.tar.gz with $BACKUPNAME.
At line 24 I inserted
line 97 was changed to reflect the filename in addition to the device
and the same change to line 125.
Changed the instructions on line 13 to reflect this change and the other command line options.
The only glitch I've found is argument $2 has to be non-null and I guess a space doesn't work. Therefore I get the colorful line with the spinning thingy instead of tar being verbose. Perhaps an or in the if checking for $2 eq "verbose" (sure thats the wrong syntax) in addition to null. I havn't tested it with blowfish. I am using DSL 4.4
I am using this to backup parts of my DSL/Apache web server hard drive install named by project and date stamped so I can roll back to an earlier version when something experimental fails.
Posted by chaostic on Oct. 10 2008,01:37Cron job
"sudo filetool.sh backup z hdd4 project_$(date +%F)"
Makes the backup as backup_project_2008-10-09.tar.gz, if used today.
$(date +%Y_%m_%d) if you prefer
backup_project_2008_10_09.tar.gz instead :P
Posted by chaostic on Oct. 10 2008,01:40Also, a space won't work for $2 because an unescaped space is treated as a whitespace. You could try
sudo filetool.sh backup \ hdd4 project_$(date +%F)
Note, two spaces after \
sudo filetool.sh backup " " hdd4 project_$(date +%F)
Posted by spark-o-matic on Oct. 10 2008,05:13Hi chaostic
Ok, note the last part of my signature (I must have had one of those). If a character doen't work put a \, if a string doesn't work put it in quotes. As long as I have been writing in PERL I should have known better.
The example was just by way of illustration of the functionality. I hand name most old archive versions because I may not make a copy to roll back to until I am doing something thay may go completly wrong so I may call todays backup 2008_june. But an automatic date stamp as an option wouldn't be hard.
(In fact I'm gonna give that a quick go right now)
Posted by spark-o-matic on Oct. 10 2008,06:33Ok, the inserted code becomes
And it needed "" instead of " " because -z is looking for a edit:* "null string" not a space. I guess I was for some reason thinking whitespace could be a deliminator
*edit: null is the ASCII character 0 and -z looks for a string of 0 length or a "null string" not a null