| 
  
   Size: 3003 
  
  Comment:  
 | 
  
   Size: 3062 
  
  Comment:  
 | 
| Deletions are marked like this. | Additions are marked like this. | 
| Line 104: | Line 104: | 
| DATE=`date '+%FT%T'` | DATE=`date '+%Y%m%d%H%M%S'` | 
| Line 109: | Line 109: | 
| tar cvzf $FILENAME Documents GNUstep ThunderbirdMail Desktop .Skype scripts | tar cvzf $FILENAME Documents GNUstep ThunderbirdMail Desktop .Skype scripts moin-1.9.7 # tar tvzf backup_20150108103242.tar.gz  | 
Filter unique values from third column, separated by space
   1 cat datax.log |  awk -F ' ' '/IMEI/{print $3}' | sort | uniq | wc -l
Filter unique values from third column, separated by :
   1 cat datax.log |  awk -F ':' '/IMEI/{print $3}' | sort | uniq | wc -l
Search for text in files recursively
Copy files to other destination (Win32)
@echo off REM Mount drive echo Mounting remote drive net use z: \\192.168.1.1\backs password /USER:userx REM copy current day files echo Copying current day files forfiles -p "I:" -s -m *FULL*.sqb -d +0 -c "cmd /c copy @path Z:\BACKUPS\@file" echo Deleting files older than 7 days REM delete files older than 7 days forfiles -p "Z:\BACKUPS" -m *.sqb -d 7 -c "cmd /c del @path"
Gzip files that where last modified in 30 or more days (Win32)
forfiles /p "c:\logs" /d -30 /m *.log /c "cmd /c gzip @path "
Run task every day at 01:00 (Win32)
at 01:00 /every:M,T,W,Th,F,S,Su c:\task.bat
Block responses to pings
Zip SVN modified Java files
Deploy EAR script
   1 #!/usr/bin/bash
   2 # deploy EAR in remote JBoss . 
   3 # Must have pub SSH keys (authorized_keys) deployed on remote server
   4 # Can be used with cygwin
   5 FILEX=sample.ear
   6 DEST_DIR=/opt/jboss/server/default/deploy/
   7 ECLIPSE_PROJECT=/home/userx/workspace/sample-ear/
   8 
   9 deploy()
  10 {
  11   SERVER=$1
  12   USER=$2
  13   echo "Deploying in $SERVER ..."
  14 
  15   cd $PROJECT
  16   scp target/$FILEX $USER@$SERVER:/tmp
  17   ssh $USER@$SERVER -C "mv /tmp/$FILEX $DEST_DIR/$FILEX"
  18   ssh $USER@$SERVER -C "ls -lah $DEST_DIR"
  19   ssh $USER@$SERVER -C "chmod 666  $DEST_DIR/$FILEX"
  20   ssh $USER@$SERVER -C "/sbin/service jboss abort"
  21   ssh $USER@$SERVER -C "sudo /sbin/service jboss start"
  22 }
  23 
  24 deploy "example-server" "userx"
List JAR contents to file
- cd ~/.m2/repository
 find . -name "*.jar" | xargs -i jar -tf {} > /tmp/explodedJars.txt
find . -name "*.jar" | xargs -i sh -c "echo {} ; jar -tf {}" > /tmp/explodedJars.txt
Size of each directory inside current directory
- find . -maxdepth 1 -type d | xargs -i du {} -hs
 
Backup folders in HOME
   1 #!/bin/bash
   2 # cd ~
   3 # ln -s scripts/backup.sh backup.sh
   4 # sh backup.sh
   5 DATE=`date '+%Y%m%d%H%M%S'`
   6 FILENAME=~/backups/backup_$DATE.tar.gz
   7 cd ~
   8 mkdir -p ~/backups
   9 rm $FILENAME
  10 tar cvzf $FILENAME Documents GNUstep ThunderbirdMail Desktop .Skype scripts moin-1.9.7
  11 # tar tvzf backup_20150108103242.tar.gz
  12 
