Wednesday, July 29, 2015

Grails: WAR packaging error: /foo/bar/resources/grails-app does not exist

When doing

grails war

or

grails run-war

and you get the error

WAR packaging error: \foo\bar\resources\grails-app does not exist

then you might forgotten to put a messages.properties file in i18n directory (even if you do not use grails i18n)




Monday, May 4, 2015

Disable emails after each cron execution

To disable sending emails to your mailbox after each cron execution, simple put an
EMAIL="" 
line right in the start of your cron file (crontab -e)


Tuesday, April 21, 2015

Find and clean / remove files with a specific pattern in a deep directory tree

If you need to remove all the files that comply to:
* file pattern (eg *Uploads/*.pdf)
* a size constraint (eg >= 50k)
* older than some days before today (eg 365 days older)


find . -wholename *Uploads/*.pdf -size +50k -mtime +365 -print0 | xargs -0 rm

Create a zip file per directory and delete the directories

for i in *do[ -d "$i" ] && zip -rmT "$i.zip" "$i"done
# just -r for only zip (mT is for delete)
Remove only directories in Linux

cd thedirrm -rf */

Installing VirtualBox in Linux could fail about no kernel sources available DKMS.



If this is the case then set KERN_DIR variable and then again retry installing VirtualBox

## Current running kernel on Fedora ##
KERN_DIR=/usr/src/kernels/`uname -r`
## Current running kernel on CentOS and Red Hat (RHEL) ##
KERN_DIR=/usr/src/kernels/`uname -r`-`uname -m`
## Fedora example ##
KERN_DIR=/usr/src/kernels/2.6.33.5-124.fc13.i686
## CentOS and Red Hat (RHEL) example ##
KERN_DIR=/usr/src/kernels/2.6.18-194.11.1.el5-x86_64
## Export KERN_DIR ##
export KERN_DIR



Source: http://www.if-not-true-then-false.com/2010/install-virtualbox-with-yum-on-fedora-centos-red-hat-rhel/

Wednesday, February 25, 2015

Find current sql sessions in MS SQL SERVER, getting also client IPs

SELECT
    B.login_name,
    A.client_net_address,
    NoOfConnections = COUNT(*)
FROM
    sys.dm_exec_connections A
        INNER JOIN sys.dm_exec_sessions B ON
            A.session_id = B.session_id
GROUP BY
    login_name,
    client_net_address