Показаны сообщения с ярлыком admin. Показать все сообщения
Показаны сообщения с ярлыком admin. Показать все сообщения

понедельник, 6 июня 2011 г.

BackupYourSystemTAR

tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev / 
Restore:
tar -xvpzf /home/test/backup.tar.gz -C /
mkdir /proc /lost+found /sys /mnt /media

суббота, 1 января 2011 г.

Nice tip

After accidentally rebooting the wrong server a couple times, forgetting what I had ssh’ed to, I decided on a handy fix, this /usr/local/bin/confirm script:
#!/bin/sh
echo "You are about to run the command '$*' on `hostname`." >&2
echo -n "Are you sure this is what you want to do? (Y/N): [N] " >&2
read x || exit
case "$x" in
[Yy]*)  exec "$@" ;;
*)      echo "Command '$*' aborted." >&2  ; exit 1 ;;
esac
Now, on my servers I add these aliases to root’s .bashrc file:
alias halt=’confirm halt’; alias reboot=’confirm reboot’
That’s saved me a few times since then. The .bashrc file also already had the “alias rm=’rm -i’” in there, which at first I hated, but learned to like it after it too saved my skin on more than one occasion.
@via http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html