Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

dallas

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

add apache to users group

// this handy one liner is used on any new webserver..
// puts apache into the users group to allow dev teams etc..

sed -i 's/users:x:1000:admin/users:x:1000:admin,wwwrun/' /etc/group

ssh remote systems

// This little gem enables me to execute commands on a group of systems
// just run this script and put whatever commands you want after it.. eg
// script.sh uname -a
// and it will execute 'uname -a' on all the listed hosts. make sure you setup
// ssh keys so you don't have to type in a bunch of passwords.

#!/bin/bash
HOSTLIST="web2 web3 web4 vm1 dev"
USER="mylogin"

for H in $HOSTLIST; do
        echo -n "$H: " && ssh $USER@$H $*
done  

Finding large files

// Hi all, just a cheap and easy way to find a bunch of large files on your server etc..

#!/bin/bash
for file in `find / -type f -size +100000`; do
        ls -lh $file
done

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed