Welcome to JRI's Help page for Linux "stuff"

This web page is designed to have quick info about various Linux stuff. Much of what is here are links to other sites that have the info in question.

avantepaths

/usr/local/bin/avantescripts/avantepaths is a common script that should be called by each Avante script. It contains all the setup that is needed for our Avante scripts. This should greatly reduce the redundancy of our scripts, and make them very easy to change when we upgrade Avante or move the file systems.
At the time of this writting, the script looks like:
# common Avante paths & other Avante stuff # JRI 07-27-07
# This is read by root's .profile at boot time and /etc/profile
# by all other users at login.
#-------------------------------------------------------------------
# Apparently, cron does NOT read this when it starts a session
# so it must be specifically run by each Avante script.
#-------------------------------------------------------------------

### The following are paths to our 3 main areas
export LIVEPATH=/usr/igi/avante94/flodata/live/LIVE.DATA
export PILOTPATH=/usr/igi/avante94/flodata/train/PILOT94.DATA
export TESTPATH=/usr/igi/avante94/flodata/dev/TEST94.DATA

### The following is the path for live Avante scripts & control files
export AVANTESCRIPTS=/usr/local/bin/avantescripts/live

### setup for Unidata environment
UDTHOME=/usr/igi/ud
UDTBIN=/usr/igi/ud/bin
PATH=$PATH:/usr/igi/ud/bin
export UDTHOME UDTBIN PATH
TERM was recently removed due to problems with Oracle. Individuals who connect to UniData/Avante all get the needed TERM setting from the SB Client software. The scripts from from cronuser's crontab all need to have: export TERM=vt100

avantescripts

/usr/local/bin/avantescripts is a directory that contains 3 subdirectories
    live
    pilot
    test
plus the script avantepaths.
All scripts that are run from cronuser's crontab should be moved to the appropriate sub-directory, and cronuser's crontab should be altered to point to that location. The ...INPUTS and ...RESULTS files that are used by our scripts should also go here.
Below is a sample script in /usr/local/bin/avantescripts/live. This script will:
1) run the script avantepaths
2) cd to the live data account
3) start a UniData process using ...INPUT for feeds and ...RESULTS to capture output
4) E-mail the script as the body of the E-mail to israejr
#JRI 07/25/07
# Temp script to test paths and vars for cronuser

#change directory and run the report
. /usr/local/bin/avantescripts/avantepaths
cd $LIVEPATH
udt < $AVANTESCRIPTS/JRI.JUNK.INPUTS > $AVANTESCRIPTS/JRI.JUNK.RESULTS
(cat $AVANTESCRIPTS/JRI.JUNK) | mailx -m -s "cronuser Test - LIVE" israejr@daysup.com
Do not confuse the "avantepaths" script with the "AVANTEPATHS" variable.

cancel

To delete a print job from a Linux print queue, you must:
1) shell out to Linux
2) switch user to root (su -)
3) find the unwanted job in the print queue with the lpstat command
4) delete the actual print job:
cancel Qqueue#-job#

cron

cron is a background process that is always running, and automatically starts when Linux boots. It is the Linux process that actually processes the various crontab files.
To start or stop cron:
cd /sbin/init.d
./cron start
./cron stop

crontab

Login as cronuser.
Prior to making a change to the crontab, do the following:
    cd $HOME
    crontab -l > crontab-2025-10-21
    (backup current file with today's date)
    crontab -l > crontab-mx     (make a working copy)
Make changes to the working copy (vi crontab-mx or with SlickEdit or NotePad++)
    crontab crontab-mx     (load your temp file, crontab-mx, back into crontab)
Verify your change (optional)
    crontab -l | grep what you are looking for

crontab Format
# Use the "#" sign to prefix a comment
# +---------------- minute (0 - 59)
# | +-------------- hour (0 - 23)
# | | +------------ day of month (1 - 31)
# | | | +---------- month (1 - 12)
# | | | | +-------- day of week (0 - 6) (Sunday=0)
# | | | | |
# * * * * * command to be executed

Also see SCRIPT.DRIVER

Not enough info? More…

cups

c Linux Printer Setup:
http://dayavante:631

find

Find a file:
shell out as su (to avoid the annoying privlage errors)
find . -name filename -print

head

Show the first 1,000 bytes of a file (like a huge RESULTS or COMO file)
head -c 1000 FileName

The above will likely mess with the SB Client display due to the escape characters. As a trick, do something like this instead:
head -c 1000 FileName > JRI.txt
Then use NotePad++ to view the JRI.txt file

ln

Build a symbolic link:
ln -s true_file_path symbilic_file_path
ln -s /usr/igi/avante98 /home/yourID/avante98dir

Note1: deleting a symbolic link does not touch the original file/dir - it is safe to delete.

Note2: if you have an account that is not in the normal account structure, you will need to build a symbolic link to dldata or the Emailer (SYSS9002.1) will not be able to build attachments. For example, if we have an account at:
    /software/DEV.BUBBA
we would need to drop to Linux and type:
    ln -s /av1/igi/avante98/flodata/dldata /software/DEV.BUBBA/dldata

lp

Send a file to a print queue:
more filename | lp -dQ125

lpstat

To see all the jobs in all the print queues:
lpstat

To see all the jobs in a specific print queue:
lpstat Qqueue#

mailx

Build a txt file with the desired verbage (ex: email.txt) and send attachment (ex: attach.txt):
(cat email.txt;uuencode attach.txt attach.txt) | mailx -m -s "subject" recipiant1,recipiant2, etc...
Also see sendmail.

omni

From TCL, type:
OMNI

If uniproxy is down:
!su -
cd /opt/omni/sbin
omnisv -starrt (this takes a moment to finish)

sendmail

Build a txt/html file with the desired verbage (ex: Email.html) and send optional attachment (ex: attach.txt):
E-mail w/o attachment:
(cat Email.html) | sendmail -t -n -v
E-mail w attachment:
(cat Email.html;uuencode dummy.xls dummy.xls) | sendmail -t -n -v
where:
-t = get the recipients from the Email itself
-n = do not do aliasing
-v = verbose
Note that the subject is also part of the Email file (not passed as in mailx).

SCRIPT.DRIVER

SCRIPT.DRIVER is a Linux script that is called by a parent script to To ensure a "clean" run, this script will "touch" the ...RESULTS file.
To ensure that we can all read the ...RESULTS file, this script will do a chmod 666 on the ...RESULTS file.
If the child script fails to run, an in depth E-mail will be sent describing the problem. If the user is root or cronuser, then the E-mail will go to the Avante IT staff, otherwise it goes to the user running the process (assumes the user is debugging).
To work properly, this process will need several files:
File Name File Description
scriptname.DRIVER A 1-line driver program, most likely run from cron (see above)
scriptname A 3-line script that is actually run by SCRIPT.DRIVER
scriptname.RESULTS The output file created by scriptname
scriptname.INPUTS A control file used to feed answers to Avante and any prompts in the process
Note that this naming convesion is not required, but certainly advised
These scripts should be stored in $AVANTESCRIPTS (/usr/local/bin/avantescripts/live)
Be sure to set the permissions correctly!

parent script

The parent script is the script that is run from cron. The parent script process must contain 3 lines:
. /usr/local/bin/avantescripts/avantepaths
cd $AVANTESCRIPTS
./SCRIPT.DRIVER childScript resultsFile maxAttempts parentScript
where:
childScript - the script that does the ultimate Avante task
resultsFile - the file that captures the output from Avante
maxAttempts - the number of attempts to try before aborting
parentScript - the script that calls SCRIPT.DRIVER to initiate the task
Note that the 1st and 2nd lines of the script are needed to ensure that the driver script will run from anywhere.
These scripts should be stored in $AVANTESCRIPTS (/usr/local/bin/avantescripts/live)

parentScript
        |
        +--> SCRIPT.DRIVER
                      |
                      +--> childScript
Be sure to set the permissions correctly!

child script

The child script is the script that will actually do the main task that is needed. It will likely start a UniData process, then either run a SB process or bail out to TCL and run a program, then finally logoff. The child process must contain 3 lines:
. /usr/local/bin/avantescripts/avantepaths
cd $LIVEPATH
export TERM=vt100
udt < $AVANTESCRIPTS/scriptname.INPUTS > $AVANTESCRIPTS/scriptname.RESULTS
where:
scriptname.INPUTS - contains the responses to the various prompts and possibly additioanl programs
scriptname.RESULTS - contains the output (screen captures) of the job
These scripts should be stored in $AVANTESCRIPTS (/usr/local/bin/avantescripts/live)
Be sure to set the permissions correctly!

dubbel trouble with Stevie Ray Vaughn