Sponsored Content
Full Discussion: Retry Logic But In Cron
Top Forums UNIX for Beginners Questions & Answers Retry Logic But In Cron Post 303046120 by jgt on Friday 24th of April 2020 10:58:49 AM
Old 04-24-2020
In the following, the index file is placed in the requests directory, and the image file in the temp directory. The index files can have different extensions to indicate grouping or priority.
The pid file is used to prevent subsequent invocations of the cron job from running.
You can periodically examine the contents of the temp and request directories for entries that older than some specified time.


Code:
#!/bin/ksh
cd /u/email
BATCH=$1
proc=$$
if [ -r /u/email/$BATCH.pid ]
then
    echo "Previous batch  still running" $(cat $BATCH.pid)
    exit
fi
echo $proc >/u/email/$BATCH.pid
list=$(ls requests|grep $BATCH)
if [ "$list" != "" ]
    then
    for request in $list
    do
    #do processing here          
    #if successful 
        mv requests/$request done
        mv temp/$request* done
    #else
       #echo "This one failed"
       #fi
    done
fi
rm /u/email/$BATCH.pid
echo finished at $(date)

 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Retry upon FTP failure

I am using the following code in a C Shell script to transfer files to a remote server: ftp -n logxx.xxxx.xxx.xxx.com <<DO_FTP1 quote user $user_name quote pass $password ascii put $js_file_name bin put $FinalZipFile quit DO_FTP1 This code works great except on those rare occasions... (8 Replies)
Discussion started by: phudgens
8 Replies

2. Shell Programming and Scripting

If then else - Retry operation

I need to read a file line by line, then depending on the contents of each line, type in a code that will get written to an array. The problem I have is when I ask the user to confirm the input code, if it is wrong, how do i Return to ask again? Any thing I try increments the file to the next... (6 Replies)
Discussion started by: kcpoole
6 Replies
SQUEAK(1)																 SQUEAK(1)

NAME
squeak - Unix Squeak virtual machine launcher SYNOPSIS
squeak squeak [image filename] [project filename] DESCRIPTION
squeak is the virtual machine for the Squeak Smalltalk system. It requires three files to operate correctly: an image file containing a `snapshot' of a live Squeak session, a changes file containing the source code for modified methods in the image, and a copy of (or a link to) a shared system sources file containing the source code for methods that have not been modified since the last major version increment. The image and changes files contain the state of a user's Squeak session, which is persistent between consecutive sessions. Private copies of these files are therefore normally required. The squeak script checks that the local Squeak installation appears sane, and then copies the required files to the current working directory. If squeak encounters no problems, it will finish by running squeak vm to start a Squeak session using the newly copied image and changes files. INVOCATION
squeak accepts an optional image name, and/or an optional project name. If an image name is given on the command line then squeak tries to run that image. Otherwise squeak checks the environment variable SQUEAK_IMAGE and, if it is set, uses its value as the name of the image to run. Otherwise squeak looks for available images in the ~/squeak and /usr/share/squeak directories. Then, squeak shows a dialog with all the available images for the user to choose one of them. If the chosen image is at SQUEAK_IMAGE_DIR (which is by default /usr/share/squeak), it will be copied to ~/squeak. If only one image is available, no dialog will be shown and the script will run that image. The image argument can be followed by a project name. This is the name of a 'document' that should have been saved from a Squeak image. The project name must have the '.pr' extension. The project argument can also be providen without an image name. In that case, squeak will look for an image to run the project following the same criteria explained above. ENVIRONMENT
To know all the environment variables that can affect the squeak image launching, take a look at the Environment section of the squeakvm man page. Appart from those options, these are applied to this script: SQUEAK_IMAGE_DIR is the directory, together with ~/squeak where the launcher looks for Squeak images. (The default value is /usr/share/squeak) SQUEAK_IMAGE is the name of a image file to be run by the script. SQUEAK is the name of an alternative vm (or alternative vm options) to be run by the script. The script launches the vm with these default options: '-mmap 1024M -nomixer' NOTES
This manual page documents version [version] of Unix Squeak. It may not be appropriate for any other version. The image and changes files containing a saved Squeak session are intimately related. They should always be used together, never be sepa- rated, and under no circumstances should an image be run with a changes file that has been used with a different image. Failure to adhere to the above could cause the source code for the methods in the image to become garbled and impossible to retrieve. The Unix Squeak virtual machine fully supports OpenGL in both the X11 and Quartz display drivers. Open Croquet will run just fine with either of these drivers (and many Mac OS X users will even have the choice of which driver to use :). Because of licensing issues, a Squeak image or Squeak sources package is not available in Debian yet. So the user must download a proper image in order to get this script useful. Available images can be found in these web sites: The official Squeak home page: http://squeak.org The SqueakLand (international educational oriented) world: http://www.squeakland.org The spanish educative oriented Squeak page: http://squeak.educarex.es/ AUTHOR
This manual page was written by Jose L. Redrejo for the Debian project SEE ALSO
squeakvm(1). SQUEAK(1)
All times are GMT -4. The time now is 01:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy