| Library file | Function | Sections | Content | help file |
|---|---|---|---|---|
| bmtLinux | bmtLinuxFunc | 401-410 | Linux related | bmtLinux.md |
- 401 Check package installed
- 402 Linux distribution family checker
- 403 Set text editor $EDITOR if not set
- 404 Log file handler
- 405 Check if user exists
- 406 Variable set and/or empty check
- 407 Run script as root check
- 408 Check if command exists in system
- 409 system information
- 410 Check if a named process is currently running
Keyword is checkpac.
- Param $2 package name
- Param $3 type of linux distro (1 for pacman based, 2 for debian based, 3 for rpm based)
- Param $4 to display message or not include "MES" for verbose output.
- Returns 0 for installed , 2 for not installed, returns 52 for unknown distro type.
bmtLinuxFunc checkpac "firefox" 2 "MES"bmtLinuxFunc distrocheckReturns 2-7 for known distro family groups or 52 for unknown. (2 redhat based, 3 fedora based, 4 debian based, 5 pacman based, 6 gentoo based , 7 slackware based.)
bmtLinuxFunc isTextEdSetreturns 0 if it was set, 2 if not and sets it to vi
Creates a log file entry with standard formated date/time stamp.
| Option | Option description |
|---|---|
| 1 State | valid states are EMERGENCY, ALERT, CRITICAL, ERROR,WARNING,NOTICE,INFO,DEBUG,OK,FAILED,PASSED returns 55 for invalid state |
| 2 Message | if blank message passed "-- empty log message" appended |
| 3 Filename | .log will be appended |
| 4 Path | path for log file |
| 5 Echo | if "MES" log message will also be echoed to console |
bmtLinuxFunc log "CRITICAL" "1201 alarm Executive overflow - no vacant areas" mylog /tmp/
bmtLinuxFunc log "CRITICAL" "1202 alarm Executive overflow - no core sets" mylog /tmp/
bmtLinuxFunc log "INFO" "62 Watchdog reset" mylog /tmp/ "MES"Check if user exist on system Returns 0 if exists, 2 if not.
bmtLinuxFunc user "gavin"
echo "$?"Returns 0 if set and non-empty, 2 if set and empty , 3 if unset
bmtLinuxFunc isvarempty variable_name
echo "$?"Returns 2 if not running as root
bmtLinuxFunc runasrootReturns 2 if command does not exist on system.
bmtLinuxFunc iscommand tput
echo "$?"Prints system information to console, tool: uname -a
bmtLinuxFunc sysinfoReturns 0 if process is running, 2 if not.
bmtLinuxFunc proccheck "firefox"
echo "$?"