Archive for the ‘bash’ tag
Move files with zenity progress bar
I’m playing with a script that moves files between two directories and does that by piping two tar commands, so called Fast Copy.
You need zenity to see the progress bar, it is a work in progress as there are some bugs, eg when you click “cancel” the two tar child processes are not killed for some reason, I couldn’t get the correct exit code that probably gets lost somewhere.
Probably in the future I’ll write a better notification.Suggestions and modifications are wellcome.
Move files in bash with tar and progress bar
Example
gas@caldaia ~ $ my_move source_dir/ dest_dir/
43.5GB at 61.0MB/s eta: 59s 91% [=========== ]
You need to install “command line progress bar”, in gentoo it can be installed with emerge bar in ubuntu the deb can be grabbed here and installed with gdebi.
my_move:
#! /bin/sh
SOURCE="$1"
DEST="$2"
SIZE=$(du -sb "$SOURCE"|awk '{print $1}')
(cd "$SOURCE" && tar -cf - *)|bar -s $SIZE| (cd "$DEST" && tar -xBpf -)
Kiss WordPress Upgrade Script
Description
This is a KISS ( Keep It Simple Stupid ) script to backup and upgrade to the latest version your wordpress blog.You will need a shell / ssh to run this script ( tested on standard linux bash ).
Features
- No configuration needed
- Full Database Backup
- Full blog root backup excluding the backup directory
- Automagic blog upgrade
- Easily written and hence easily adaptable
Installation
open a shell and “cd” to your wordpress blog root path ( the one that contains wp-admin directory or wp-config.php for example)
wget http://www.lucagasperini.com/wpautoupgrade.sh
chmod u+x wpautoupgrade.sh
Usage
open a shell and “cd” to your wordpress blog root path
sh wpautoupgrade.sh
Now point your browser to http://www.example.com/wp-admin/upgrade.php
Restore
I have an idea for doing things the KISS way but no time for now so you have to do things manually . The backup performed is standard so you can simply follow the codex.
Notes
- Two different backups are made , content and sql table, they are stored in /pathtoblog/backup.
- To download your blog backup file point your browser to http://www.example.com/backup/files.tar.gz.
- To download your sql table backup point your browser to http://www.example.com/backup/sql.gz
- All backups are kept and are not backed-up ( buckups don’t contain older backups). This mean that over time the backup directory can potentially become huge.Check it and delete older ones
- I didn’t want this script to call the upgrade.php autamatically cause it means no feedback at all.
- If you don’t have a standard wordpress install don’t use this script. For example if you use a Debian package to install wordpress this script won’t work because the deb has been debianized and all config have been moved to /etc/wordpress rather than standard /blogroot
- If it doesn’t work is your fault
Multiple apes
As a reminder , the [tag]bash[/tag] command to use for decompressing a bunch of monkey’s audio ape files in a directory:
ls |while read line; do mac "$line" "$line".wav -d; done;