Archive for August, 2011

Run perl command in bash script [complicated variables]

2011-08-17 Leave a comment

A simple little command that gets the epoch time of a file using perl and bash.

## Resolve the $f var before running the perl line by having the perl command in double quotes
## Double escape the perl var so the shell does not resolve it.
mtime=`perl -e "\\$t = (stat('$f'))[9]; print \\$t;"`
echo $mtime
Categories: Bash, Linux, Perl, Programming

XAMPP virtual hosts multiple sites

2011-08-01 Leave a comment

To set up multiple sites with XAMPP for development you’ll need to edit the following files.

Any line followed with a ## texthere was edited and the following text was the original setup.

Only do this on a local dev enviroment

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny ## Order deny,allow
    Allow from all ## Deny from all



## Uncomment the following line
NameVirtualHost *:80

## Add for each host you want.
<VirtualHost *:80>
    ServerAdmin postmaster@mysitedev
    DocumentRoot "C:\my\site\root\dir"
    ServerName mysitedev
    ErrorLog "logs/mysitedev-error.log"
    CustomLog "logs/mysitedev.log" combined
Categories: Windows

List all users Crontab one liner

2011-08-01 Leave a comment

This grabs each user on the system from the passwd file and then checks to see if they have a crontab and prints out the results.

for u in $(cut -f1 -d: /etc/passwd); do sudo crontab -u $u -l; done
Categories: Bash, Linux, Programming