I recently wanted to setup a custom action in Quicksilver to do a simple task. Take any text I provide in the Object pane and write it to a file with a bit more around it.

After trying to write something in applescript and quickly giving up, I found an article that would allow me to write a custom action in Ruby.

Create a custom ruby script and put it into ~/Library/Application Support/Quicksilver/Actions (you may have to create the Actions directory)

This is what my script looks like. It’s ‘addTodo.rb’ I used this as an opportunity to try and pick up some ruby too so please forgive any newbie faux pas. This script creates a CSV and appends to it so I can open it in Excel or something similar.


#!/usr/bin/ruby
# writes to a file with a date

todo = ARGV[0]
now = Time.now
filename = "/Users/anoop/Documents/todos/todo.csv"

if !File.exists?(filename) then
filehandle = File.open(filename, "w")
filehandle.puts "Week Number, Time of Update, Update"
else
filehandle = File.open(filename, "a")
end

# format the date so that we have the week #, the current date and then the buffer
todobuff = now.strftime(“\”Week %U\”, \”%a %m/%d/%Y %H:%M:%S\”,”) + “\”" + todo + “\”"
filehandle.puts todobuff
filehandle.close

Save this file and restart Quicksilver (I had to restart it twice)

Activate Quicksilver, and type in

.your item for the todo list

In the action window, simply type search for ‘addTodo’ and you should see your newly added action. Execute and then confirm that the script was executed successfully.

Enjoy!

We do this on a daily basis and sometimes this can be a pretty daunting task. For that reason, I put this article together based on documentation I’ve written for work. Please let me know in the comments if you run into any issues.

The benefit of using something like AD for authentication is that users are less likely to share passwords with each other for one off generic accounts created on boxes as well as easier account management.

Start by installing samba3x packages for your respective architecture


yum install samba3x-winbind.x86_64

This will install winbind and any other dependencies.

Next, verify your /etc/hosts and /etc/resolv.conf and make sure it’s correct. Hosts should not have something like


127.0.0.1 FQDN_OF_HOST localhost.localdomain localhost

it should be


127.0.0.1 localhost.localdomain localhost
REAL.IP.OF.HOST FQDN_OF HOST HOSTNAME

Next, check the date and time and make sure that’s correct and extremely close to the time on the server.

Next, run this command to add the host to the domain, configure samba, etc.


/usr/sbin/authconfig-tui \
--enablewinbind \
--enablewinbindauth \
--enablemkhomedir \
--enablepamaccess \
--enablelocauthorize \
--smbsecurity=ads \
--smbrealm=DOMAIN.EXTENSION \
--smbworkgroup=DOMAIN \
--smbservers=DOMAINCONTROLLER1.DOMAIN.EXT,DOMAINCONTROLLER2.DOMAIN.EXT
--winbindtemplatehomedir="/home/%U" \
--winbindtemplateshell="/bin/bash" \
--enablewinbindusedefaultdomain \
--kickstart \
--winbindjoin=ADMINISTRATORACCOUNTNAME

Provide your password for the account above and watch the error messages that appear. This command will also restart winbind for you.

Ensure that it’s still running with


service winbind status

or look for errors in the log files. Possibly /var/log/messages or /var/log/samba/wb-DOMAIN.log

If that’s working, you should be able to login now over ssh


ssh username@host

Access Controls

You can control which groups/users can login from /etc/security/access.conf. The ” –enablepamaccess” instructed PAM to look at access.conf whenever anyone tries to login. Watch for spaces in the group/usernames. It doesn’t work as well


+ : GROUP_NAME or USER_NAME : IPs or ttys or ALL
- : ALL : ALL

+ says that a user can login.
- says that a user cannot. The second line says deny everyone.

Sudo privileges

You can use the same group above to setup sudo privileges as well using ‘visudo’ as root

NOTE: these instructions may differ a bit if you’re trying to login with an account in a subdomain.
NOTE: You may or may not want to setup DNS for this host in AD prior to joining the domain. I recommend doing it prior to. Creating a computer account for it is not necessary prior to joining.

Spacewalk, it’s pretty damn awesome. Or at least, I think it is. It’s an open source linux systems management solution from Redhat (GPLv2).

Once you get spacewalk up and running, you’ll be amazed by some of the things it does. It can push config files, packages, inventory systems, group them and allow you to work exclusively with those groups in a very easy way. That’s only scratching the surface of what spacewalk is capable of.

I like it because I can setup custom channels where I can push custom software to each of my servers. From time to time though, I notice that the repos don’t really rebuild automatically. If you look at the “details” section of your channel, you’ll notice something like this

The times don’t match. It probably means that the taskomatic daemon is not running or is running but isn’t really pulling tasks from the database.

To verify, login to sqlplus and run this query

sqlplus spacewalk/spacewalk@xe

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Nov 13 14:14:00 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> select * from rhnTaskQueue;

ORG_ID TASK_NAME
---------- ----------------------------------------------------------------
TASK_DATA PRIORITY EARLIEST
---------- ---------- ---------
1 update_errata_cache_by_channel
143 0 13-NOV-10

1 update_errata_cache_by_channel
122 0 12-NOV-10

1 update_errata_cache_by_channel
208 0 13-NOV-10

ORG_ID TASK_NAME
---------- ----------------------------------------------------------------
TASK_DATA PRIORITY EARLIEST
---------- ---------- ---------
1 update_errata_cache_by_channel
122 0 13-NOV-10

Notice how some tasks are older? This table should almost always be empty or only have data for a small period of time as the name suggests.

Restarting taskomatic is as simple as


[root@spacewalk init.d]# ./taskomatic stop
Stopping RHN Taskomatic...
Stopped RHN Taskomatic.
[root@spacewalk init.d]# ./taskomatic start
Starting RHN Taskomatic...

Wait about 10 minutes, because that’s the polling time for taskomatic, and then check the database again. There should be no rows


SQL> select * from rhnTaskQueue;

no rows selected
SQL>

Also check the spacewal UI and look for something like this

or

Spacewalk is still very much in its infancy but it shows great promise and there is a great community of people who are willing to help and are dedicated to making it a rich and feature full product. Spacewalk 1.1 was released recently and we haven’t had a chance to upgrade yet but I continue to see great things coming from spacewalk and that makes me happy.


© 2007 wp | anoopdotnet | iKon Wordpress Theme by Windows Vista Administration | Powered by Wordpress