This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
date=`date -I` | |
log_date=`date -u` | |
# Compress and backup /etc directory | |
tar -cvf ~/backup/etc-$date.tar /etc | |
echo "[$log_date]: Backing up /etc directory. (etc-$date.tar)" >> ~/backup/logs/_backup.txt | |
# Compress and backup /home directory | |
tar -cvzf ~/backup/home-$date.tar /home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
doContinue=n | |
echo -n "Do you really want to continue? [y/n] " | |
read doContinue | |
if [ "$doContinue" != "y" ]; then | |
echo "Quitting..." | |
exit | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
date=`date -I` | |
log_date=`date -u` | |
# Dump and compress all mySQL databases to remote external drive | |
mysqldump --user=[username] --password=[password] --all-databases | gzip > ~/backup/sql_backup-$date.sql.gz | |
echo "[$log_date]: Backing up all MySQL databases. (sql_backup-$date.sql.gz)" >> ~/backup/logs/_backup.txt | |
# Only keep mySQL backups for 14 days | |
find ~/backup/ -name "*gz" -mtime +14 -exec rm{} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
: ${1?"Usage: $0 ip subnet to scan. eg '192.168.1.'"} | |
subnet=$1 | |
for addr in `seq 0 1 255 `; do | |
# ( echo $subnet$addr) | |
( ping -c 3 -t 5 $subnet$addr > /dev/null && echo $subnet$addr is Alive ) & | |
done |