Commit f4a0fce6 by Eric Coissac

add some new function to the documentation

parent 142d7e63
Pipeline #5 skipped
......@@ -3,9 +3,9 @@
The LECA Bash Library aims to provide a set of function helping the development
of bash scripts used to submit jobs on the computation grid.
The LECA Bash Library is constituted by a set of bash scripts that can be
The LECA Bash Library is constituted by a set of bash scripts that can be
sourced in your script or directly from the interactive shell if you want
to use the functionalities of the LECA Bash Library from your interactive
to use the functionalities of the LECA Bash Library from your interactive
session.
For activating the *LECA Bash Library* you must source the `util.sh` bash script.
......@@ -14,6 +14,23 @@ For activating the *LECA Bash Library* you must source the `util.sh` bash script
> source $LECABASHHOME/utils.sh
```
once activated modules can be loaded using the `include` command.
```{shell}
> include timeout
```
The include command is aware about already loaded modules and takes care to not
reload several time the same module. To force the reloading of a module, use the
`reload` command.
```{shell}
> reload timeout
```
The module is reloaded with all its dependancies. A logging message advertise the
name of each reloaded module.
----------------------------------------------------------
# Modules provided by the *LECA Bash Library*
......@@ -25,10 +42,11 @@ For activating the *LECA Bash Library* you must source the `util.sh` bash script
- **[lecaluke](#lecaluke)** : declare variable related for the LECA computers in LUKE
- **[logging](#logging)** : adds functionnalities for managing log files and log levels
- **[mutex](#mutex)** : manages concurent access to resources through locks and semaphores
- **[sets](#sets)** : manages *set* of values
- **[sets](#sets)** : manages *set* of values
- **[stacks](#stacks)** : manages *stacks* of values
- **[tempdir](#tempdir)** : manages the creation of temporary directories and their erasements
- **[timeout](#timeout)** : provides a function for limiting the maximum execution time of a command
- **[irods](#irods)** : provide functions wrapping the iRods iget and iput icommands.
----------------------------------------------------------
......@@ -104,7 +122,7 @@ You can erase an existing file by a redirection
#### getnoclobber
```{shell}
```{shell}
getnoclobber
```
......@@ -121,23 +139,23 @@ Returns the noclobber status as a string
#### pushclobber
```{shell}
```{shell}
pushclobber
```
Saves the current noclobber mode on a stack and sets it to 'off'
#### pushnoclobber
```{shell}
```{shell}
pushnoclobber
```
Saves the current noclobber mode on a stack and sets it to 'on'
#### popclobber
```{shell}
```{shell}
popclobber
```
......@@ -145,7 +163,7 @@ Restores the last pushed noclobber mode
#### popnoclobber
```{shell}
```{shell}
popnoclobber
```
......@@ -166,7 +184,7 @@ Alias for the `popclobber` function. Using one of the both commands `popnoclobbe
#### download
```{shell}
```{shell}
download <URL> [USERNAME] [PASSWORD]
```
......@@ -177,7 +195,7 @@ to indicate a login and password for a protected connection
#### downloadandcheck
```{shell}
```{shell}
downloadandcheck <URL> <MD5URL> <DESTINATION> [USERNAME] [PASSWORD]
```
......@@ -195,7 +213,7 @@ On error the function has a return status set to *1*, *0* otherwise.
#### setmaxretry
```{shell}
```{shell}
setmaxretry <MAXRETRY>
```
......@@ -221,13 +239,13 @@ exiting in error.
#### pushifs
```{shell}
```{shell}
pushifs <NEWIFS>
```
#### popifs
```{shell}
```{shell}
popifs
```
......@@ -252,7 +270,7 @@ where LECA ressources are stored on the LUKE cluster.
#### latesttaxonomy
```{shell}
```{shell}
latesttaxonomy
```
......@@ -296,7 +314,7 @@ Therefore only `WARNING` and `ERROR` messages will be actually logged.
#### logdebug
```{shell}
```{shell}
logdebug <MESSAGE>
```
......@@ -304,7 +322,7 @@ Writes `MESSAGE` as a debug level log to the current log file.
#### loginfo
```{shell}
```{shell}
loginfo <MESSAGE>
```
......@@ -313,7 +331,7 @@ Writes `MESSAGE` as a info level log to the current log file.
#### logerror
```{shell}
```{shell}
logerror <MESSAGE>
```
......@@ -322,7 +340,7 @@ Writes `MESSAGE` as a error level log to the current log file.
#### logwarning
```{shell}
```{shell}
logwarning <MESSAGE>
```
......@@ -331,7 +349,7 @@ Writes `MESSAGE` as a warning level log to the current log file.
#### setloglevel
```{shell}
```{shell}
setloglevel <LEVEL>
```
......@@ -342,7 +360,7 @@ greater or equal to the current logging level.
#### openlogfile
```{shell}
```{shell}
openlogfile <FILENAME>
```
......@@ -352,7 +370,7 @@ If the file does not exist it is created
#### closelogfile
```{shell}
```{shell}
closelogfile
```
......@@ -375,32 +393,32 @@ Closes the current logfile and redirect the logging to stderr.
#### getlock
```{shell}
```{shell}
getlock <LOCKNAME> [global]
```
#### releaselock
```{shell}
```{shell}
releaselock <LOCKNAME> [global]
```
#### getsemaphore
```{shell}
```{shell}
getsemaphore <SEMAPHORENAME> <MAXCOUNT> [global]
```
#### releasesemaphore
```{shell}
```{shell}
releasesemaphore <SEMAPHORENAME> [global]
```
#### releaseoldlock
```{shell}
```{shell}
releaseoldlock [MINUTES]
```
......@@ -427,44 +445,44 @@ Closes the current logfile and redirect the logging to stderr.
#### newset
```{shell}
```{shell}
newset <SETNAME>
```
#### setsize
```{shell}
```{shell}
setsize <SETNAME>
```
#### setaddvalue
```{shell}
```{shell}
setsize <SETNAME> <VALUE>
```
#### setdelvalue
```{shell}
```{shell}
setdelvalue <SETNAME> <VALUE>
```
#### setcontains
```{shell}
```{shell}
setcontains <SETNAME> <VALUE>
```
#### setunion
```{shell}
```{shell}
setunion <SETNAME1> <SETNAME2> <DESTINATION>
```
#### setintersec
```{shell}
```{shell}
setintersec <SETNAME1> <SETNAME2> <DESTINATION>
```
......@@ -573,5 +591,75 @@ and the return status is set to *1* instead of *0* usually.
timeoutcmd <SECONDE> <UNIX COMMAND>
```
----------------------------------------------------------
## irods
The *irods* module define a set of function wrapping the classical `iput` and
`iget` commands.
All the log will be done on file descriptor 3
By default file descriptor 3 is redirected to stderr (2)
By default the logging level is set to `WARNING`.
Therefore only `WARNING` and `ERROR` messages will be actually logged.
### Activating the module
```{shell}
> source $LECABASHHOME/utils.sh
> include irods
```
### Functions provided:
#### isetressource
```{shell}
isetresource <RESOURCE>
```
Set the default resource used by `iput` to store data to `RESOURCE`.
----------------------------------------------------------
```{shell}
iresourceexists <IROD_SOURCE>
```
Function returning an error status according if the specified iRods
resource exists or not.
- Returns an error status set to 0 if the resource exists,
- Returns an error status set to 1 otherwise.
ex:
```{shell}
if iresourceexists $ipath ; then
echo $ipath exists
else
echo $ipath is absent
fi
```
----------------------------------------------------------
#### igetwithmd5
```{shell}
igetwithmd5 <IROD_SOURCE> [LOCAL_DEST]
```
Gets an iRods resource and check if the uploaded file is compatible with the
MD5 checksum stored on iRods to. The MD5 file must have the same name than the
downloaded resource with the `.md5` extension added.
The `LOCAL_DEST` parameter is optional and without it the downloaded file is
saved in the current working directory.
The function download the file until the MD5 check is ok or the maximum retrial
count is reached.
`igetwithmd5` is not taking care of protecting is access by a lock or a semaphore.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment