>

A script to play with later…

#!/bin/bash # members -- list all members of a group # # SYNOPSIS # members groupname # # http://superuser.com/questions/279891/list-all-members-of-a-group-mac-os-x # by Arne # Expected to work on Mac OS 10.5 and newer, tested on 10.6 and 10.7. # It could be rewritten to work on 10.4 by using "dseditgroup -o checkmember" # instead of "dsmemberutil checkmembership". # By using dseditgroup, the script could also be extended to handle # other Directory Service nodes than the default local node. # the_group="$1" # Input check and usage if [[ $# != 1 || $1 == -* ||...
read more

CentOS 6.x and Nagios – Allow Nagios to run external commands…

After what seemed like days of messing with permissions, SELinux was the problem. To solve the dreaded Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!” error, when trying to reschedule a test or acknowledge an alert, a simple setenforce 0 was the solution. Though, permissions do also have to be correct. chown nagios.nagcmd /usr/local/nagios/var/rw chmod g+rwx /usr/local/nagios/var/rw chmod g+s /usr/local/nagios/var/rw
read more

Bash: Convert Filenames to All Lowercase

Bash: Convert Filenames to All Lowercase
For today, a short little script to rename files that have capital letters in the name, to all lower case. Years ago this was a common need when copying files from a DOS based PC to a UNIX computer. That’s not so much an issue these days. However, it is a common problem when migrating a website from an IIS server, or an OS X server, to a Linux server, where case sensitivity all of a sudden becomes a concern.   It skips any files that would overwrite any previously existing files. Really, nothing too fancy here… #!/bin/bash # Shell script to rename files, in the current directory, that...
read more

File Diff Nightmare

File Diff Nightmare
Egad, I found myself trying to find the differences between two files, each with over 93,000 lines in them. There were about 100 differences between them. While vimdiff is nifty for smaller files, I just found such large files overwhelming. Meld to the rescue! While I couldn’t get it working on my MacBook Pro, it was a simple as: “sudo yum install meld” on one of my Linux desktops. A quick scp to grab both files from the server and all was good. Meld has many other features such as version control integration and visual merges but, for now, the diff saved the...
read more

BASH: Multiplatform Scripting – Where’s that command?

BASH: Multiplatform Scripting – Where’s that command?
Today’s dilema? I Revived an old script and pushed it out to a dozen or so different machines. Not really a big deal, except the script relies on the ‘uname’ command. Sadly, like many other commands, ‘uname’ isn’t always in the same place and I hate to rely on $PATH in scripts. Fortunately the solution is simple. I happen to know that it is likely in one of two places (though I check four). With this in mind a simple set of tests can get things running smoothly. #!/bin/bash if [ -x "/usr/local/bin/uname" ]; then uname="/usr/local/bin/uname"...
read more

« Previous Entries Next Entries »