Archive for the ‘Work’ Category
Trivial desktop customization
I’m currently playing with Devil’s Pie, a utility that matches windows and window events to a set of rules similar to Emacs’ (yikes! :P) S-expressions.
I installed Devil’s Pie on my work desktop (running FC6), thus:
$ sudo yum install devilspie
(I have previously organized my desktop with four workspaces: for browsing, remote SSH sessions, remote desktop sessions, and other tasks.) I then created a configuration file:
$ mkdir .devilspie && vi ~/.devilspie/workspaces.ds (debug) (if (is (application_name) "Firefox") (begin maximize (undecorate (set_workspace 1)))) (if (is (application_name) "Terminal") (begin maximize (undecorate (set_workspace 2)))) (if (matches (application_name) "^rdesktop.+") (begin center (maximize (set_workspace 3))))
and invoked Devil’s Pie: devilspie -d ~/.devilspie/workspaces.ds &. The (debug) line in the configuration is, heh, for debugging purposes so Devil’s Pie will print out events and other information, which I can then later use.
Seems pretty straightforward, though there isn’t much functionality that I can use. (Then again, my requirement is minimal: I just want to group apps to different workspaces to avoid clutter.) I can then drop Devil’s Pie in my X startup script, along with the other startup apps.
CLI shortcuts, 7
(This is part of an ongoing series on Linux CLI shortcuts and hacks.)
After editing .bashrc and .bash_profile, you can reload the values by running
$ source ~/.bash_profile
Long night
I’m still here at the office, watching text scroll down (or is it up?) the monitor. Actually, I’m backing up the whole /var partition from one of the mail servers, to make way for a larger capacity disk.
You’re thinking, duh, LVM. But this server had been set up way before LVM became stable. I could not even back up to tape — not yet, at least — because I have to get this up and fast, while keeping the server live, so I’m doing it over (of all things) USB, and 1.1 at that.
(Heh, fast. I’ve been at it since 5 PM, and I’m not nearly halfway done. *sigh* Such is life.)
Ouch!
Given:
$ ll Archive/ total 8 -rw-r--r-- 1 d3m users 10 2007-01-26 16:29 file1.z -rw-r--r-- 1 d3m users 15 2007-01-26 16:29 file2.z
What happens if:
$ cd ~/Destination; cp ~/Archive/*.z
![]()
Writing a custom init script
It’s been a long time since I did a source tar-ball install. But the production servers at work require that applications that are not part of the standard install base (from Kickstart/Jumpstart and VMWare images) should be compiled from source. It was a very refreshing experience.
So after going through the usual configure; make; make install invocation, it was time to make sure that the app is persistent at boot. I would have copied an init script from my *nix desktop, but good thing SLES had a baseline script in /etc/init.d/skeleton.
In a nutshell, the steps are:
- Define the
INIT INFOsection, as per the LSB specs. - Fill in the variables.
- Use /etc/rc.status and rc_* functions for sanity checks.
- Create the basic
start,stopandstatusfunctions. - Use YAST (System > System Services (Runlevel)) — or, if available,
innserv— to enable the startup script.
Below is a script I wrote for Apache:
#!/bin/sh # # Author: Ian Dexter R. Marquez # # /etc/init.d/httpd # ### BEGIN INIT INFO # Provides: httpd # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Start the Apache httpd daemon ### END INIT INFO HTTPD=/path/to/apache/2.2.4/bin/httpd APACHECTL=/path/to/apache/2.2.4/bin/apachectl PROG=httpd test -x $HTTPD || exit 5 test -s /etc/rc.status && . /etc/rc.status && rc_reset start() { echo -n "Starting $PROG: " $HTTPD -k start rc_status -v } stop() { echo -n "Stopping $PROG: " /sbin/killproc $HTTPD rc_status -v } status() { echo -n "Checking $PROG: pid " /sbin/pidofproc $HTTPD rc_status -v } case "$1" in start) start ;; stop) stop ;; restart) stop start rc_status ;; status) status ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi # Remember status and be quiet rc_status ;; graceful|help|configtest|fullstatus) $APACHECTL $@ rc_status ;; *) echo "Usage: $PROG {start|stop|restart|status|graceful|help|configtest|fullstatus}" exit 1 esac rc_exit
References:
