Category: unix

  • rsync only certain files

    Create a file on on the origin server and use the –files-from option cd / rsync -anvi –files-from=/tmp/only_these_files . to-server:/ cat /tmp/only_these_files /srv/www/mysite/uploaded_files/9a3d3d9046aaad4bbe3074d794a6adaf.jpg /srv/www/mysite/uploaded_files/5ca1c97efd730427f846e457bd0a0667.png /srv/www/mysite/uploaded_files/5b0923025b4a1fde3a34119bfcd56567.jpg /srv/www/mysite/uploaded_files/870ed45d9ad704deace8fb541242425a.jpg

  • Backgrounded PHP jobs in ‘STOPPED’ state

    This could be specific to the PHP package from Ubuntu. Please consider the following a disclaimer. $ php -v PHP 5.3.5-1ubuntu7.2 with Suhosin-Patch (cli) (built: May 2 2011 23:00:17) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans $ cat /etc/lsb-release…

  • Checking for the existence of domains from commandline in Bash

    while read line; do wget –quiet –spider –timeout=10 $line; if [ $? -ne 0 ]; then echo $line; fi; done < "/tmp/domains.txt" /tmp/domains.txt would hold the list of domain names separated by newline. Note this is just a quick hack and not entirely reliable.

  • SSMTP, Crontab gotchas

    I had a few cron entries that did not run and for a long a time I had no idea why. I had the MAILTO variable set at the top of the crontab and I was expecting to be mailed the output of the cron entries. I was surprised when that did not happen. Looking…

  • Using GNU grep to output just the match(es) and not the entire line containing the match(es)

    echo “hello there.” | grep -o “ello t” ello t The flag ‘o’ (not Zero) does the trick. From the man page: -o, –only-matching Show only the part of a matching line that matches PATTERN. I couldn’t find that flag as an option in the BSD Grep man page. So this might only be available…