unixb4coffee profile image

Linux for Users: Sharing Appointments with Xtick

A xtick window that displays UNIX calendar appointments.
A xtick window that displays UNIX calendar appointments.

The, "xtick," program, which you can download from the link below, makes use of an old UNIX file format that allows you to display appointment calendar entries on your desktop. You can also use, "xtick," as a simple groupware calendar application if your computer is part of a workgroup.

Xtick's appointment database is group of individual and shared files based on the, "calendar," program's file format. The, "calendar," manual page describes the file format and locations of the files. I'll describe the appointment database briefly below in case the documentation is not available on your system.

There are a few differences between, "xtick," and, "calendar," though. When, "xtick," scans an entry, it tries to resolve nearly any date and time format. Although, "xtick," displays appointments that occur on days of the week, like every Monday or Friday, it does not support floating dates for holidays like Easter, or appointments like, for example, an event that always falls on the first Monday of every month. The program will, however, display these appointments if the entry provides additional date and time information.

Also, "xtick," treats space and tab characters the same. The, "calendar," program, however, gives tab characters special treatment, in separating dates from the appointment description, and in descriptions that span multiple lines, so you should check its documentation if you want to use appointments with, "calendar," also.

A calendar entry can have any of the following formats.

12/21 Appointment on a specific date.
12/21 11:30  Appointment on a specific date and time.
Dec 21 Appointments can use names of the month.
Jan An appointment on the first of the month.
12:00 An appointment at noon every day.
Mon 12:00 An appointment at noon every Monday.
Friday An appointment that occurs every Friday.
Thursday Dec 29 An appointment that starts on one 
 line and spans multiple lines.  A line that doesn't 
 begin with a date uses the date from the last
 previous line that contained a date.

When, "xtick," starts, it looks for a file named, "calendar," in the current directory. Then it looks for a file called, "~/.calendar/calendar," in your home directory. If it does not find either of those, it looks for system calendars in, "/etc/calendar," and then, "/usr/share/calendar."

You can also specify a different calendar file with the, "-f," command line option. Typing, "xtick -h," prints a list of the options that the program recognizes.

Like, "calendar," the, "xtick," program uses, "cpp," to preprocess calendar files, so you can use the, "#include" preprocessor directive to include groups of calendar files.

The only option that, "xtick," does not support directly is the ability to collect the appointments of all users on a computer. That requires superuser privileges, and anyway, a superuser can duplicate this process with a shell script.

#!/bin/bash

HOMEDIR=home  # Where the users' home directories 
              # reside.
TMPDIR=tmp    # Where we store all of the collected 
              # entries.

for i in `cat /etc/passwd`; do
    uid=`echo $i | cut -d':' -f 1`
    if [ -d /$HOMEDIR/$uid ]; then
	if [ -f /$HOMEDIR/$uid/.calendar/calendar ]; then
	    cat /$HOMEDIR/$uid/.calendar/calendar >> \
               /$TMPDIR/calendar.all
	fi
    fi
done

As for sharing the entries with other computers on a network, you can, as the system administrator, simply store calendar entries in a, "/usr/local/share" directory and then make the volume available via NFS for other systems to mount. For a starting point to configuring NFS, consult the nfs(5) manual page. If you already share disks on a network, then this approach requires very little additional effort.

A more selective approach, which might lend itself to setting up an appointment server, is to use, "rsync," to collect appointments from each user's machine and then distribute calendars at whatever interval is necessary. I've already discussed, "rsync," configuration here, and you can find the description at http://hubpages.com/t/2a5799.




 Last updated on December 27, 2011

Useful Funny Awesome Beautiful Interesting 

Comments

No comments yet.

    Sign in or sign up and post using a HubPages account.

    8192 characters left.
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your Hubs or other sites.


    Click to Rate This Article
    Please wait working