oldjobs - starts a set of jobs for a csh/tcsh session in an xterm window


        $ source oldjobs


This csh/tcsh script starts a set of jobs for a login shell from a file listing previously executing jobs. The jobs are associated with a particular named session. oldjobs is expected to be used primarily upon login, when a previous session is to be restored. Session restoration is only partial; the previously executing jobs are restarted, but session state for each job is not part of the restoration.

oldjobs must be sourced, rather than executed. This distinction is very important.

As written now, the only jobs that are restarted are vi, nvi, and vim jobs. It is a simple matter to extend the command list if any other commands should also be restarted. Search for the string "JOBS TO START" and modify the if statement that follows. Following the existing if, it should be trivial to add additional commands to be re-executed.

The commands to be started are stored in a jobs file. Each session is associated with a particular xterm terminal. The jobs files are located in the sessions directory, which is called .sessions and is located in the user's home directory. The sessmaint command is an administrative interface for manipulating the jobs files.

Jobs files store a list of jobs the user is expecting to have available at the re-start of a particular named session. (For example, after logging out and then logging in again.) The names of the jobs files have a j- prefix. (The actual name format is given in the requirements list below.) This file can be created by redirecting the output of the shell's jobs command into the jobs file.

In addition to the jobs files, the sessions directory contains a list of "standard" sessions that the user habitually uses. This sessions file is in ~/.sessions/sessions. This list will vary from user to user. Jobs files for non-standard sessions are also stored in the sessions directory, but they are not listed in the sessions file.

Again, oldjobs must be sourced, rather than executed.

The environment must meet the following requirements:

Finally, oldjobs must be sourced, rather than executed.

This script is intended for use in an X11 windowing environment. I expect it works in other windowing environments as well.


Wayne Morrison,


Copyright 2014 Wayne Morrison

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


dirstack(1), sessmaint(1), session-tests(1)