ecm-toolchains

title: ecm-toolchains(7)

summary: ECM Toolchains Reference

text:
# ecm-toolchains(7)

## NAME
ecm-toolchains - ECM Toolchains Reference

## INTRODUCTION
Extra CMake Modules (ECM) provides some toolchain modules. Unlike normal modules, these are not included directly in projects, but specified with the CMAKE_TOOLCHAIN_FILE cache variable on the commandline.

## ALL MODULES

### AndroidToolchain
Enable easy compilation of cmake projects on Android.

By using this android toolchain, the projects will be set up to compile the specified project targeting an Android platform, depending on its input. Furthermore, if desired, an APK can be directly generated by using the androiddeployqt tool.

CMake upstream has Android support now. This module will still give us some useful features offering androiddeployqt integration and adequate executables format for our Android applications.

Since we are using CMake Android support, any information from CMake documentation still applies: https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android

NOTE:

This module requires CMake 3.18.

Since 1.7.0.

### Usage
To use this file, you need to set the CMAKE_TOOLCHAIN_FILE to point to Android.cmake on the command line:

```
cmake -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake
```

You will also need to provide the locations of the Android NDK and SDK. This can be done on the commandline or with environment variables; in either case the variable names are:

CMAKE_ANDROID_NDK

The NDK root path.

ANDROID_SDK_ROOT

The SDK root path.

Additional options are specified as cache variables (eg: on the command line):

ANDROID_ABI

The ABI to use. See the sources/cxx-stl/gnu-libstdc++/*/libs directories in the NDK. Default: armeabi-v7a.

ANDROID_SDK_COMPILE_API

The platform API level to compile against. May be different from the NDK target. Default: newest installed version (e.g. android-30).

ANDROID_SDK_BUILD_TOOLS_REVISION

The build tools version to use. Default: newest installed version (e.g. 30.0.2).

ANDROID_EXTRA_LIBS

The “;”-separated list of full paths to libs to include in resulting APK (Qt 5 only).

For integrating other libraries which are not part of the Android toolchain, like Qt5, and installed to a separate prefix on the host system, the install prefixes of those libraries would be passed as alternative roots as list via ECM_ADDITIONAL_FIND_ROOT_PATH. Since 5.30.0.

For example, for integrating a Qt5 for Android present at ~/Qt/5.14.2/android/ and some other libraries installed to the prefix /opt/android/foo, you would use:

```
cmake \

  -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \

  -DECM_ADDITIONAL_FIND_ROOT_PATH="~/Qt/5.14.2/android/;/opt/android/foo"
```

If your project uses find_package() to locate build tools on the host system, make sure to pass CMAKE_FIND_ROOT_PATH_BOTH or NO_CMAKE_FIND_ROOT_PATH as argument in the call. See the find_package() documentation for more details.

### Deploying Qt 5 Applications
After building the application, you will need to generate an APK that can be deployed to an Android device. This module integrates androiddeployqt support to help with this for Qt-based projects. To enable this, set the QTANDROID_EXPORTED_TARGET variable to the targets you wish to export as an APK (in a ;-separed list), as well as ANDROID_APK_DIR to a directory containing some basic information. This will create a create-apk-<target> target that will generate the APK file. See the Qt on Android deployment documentation for more information.

For example, you could do:

```
cmake \

  -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \

  -DQTANDROID_EXPORTED_TARGET=myapp \

  -DANDROID_APK_DIR=myapp-apk
make
make create-apk-myapp
```

You can specify the APK output directory by setting ANDROID_APK_OUTPUT_DIR. Otherwise the APK can be found in myapp_build_apk/ in the build directory.

The create-apk-myapp target will be able to take an ARGS parameter with further arguments for androiddeployqt. For example, one can use:

```
make create-apk-myapp ARGS="--install"
```

To install the apk to test. To generate a signed apk, one can do it with the following syntax:

```
make create-apk-myapp ARGS="--sign ~/my.keystore alias_name"
```

In case it’s needed for your application to set the APK directory from cmake scripting you can also set the directory as the ANDROID_APK_DIR property of the create-apk-myapp target.

See Android documentation on how to create a keystore to use

### Advanced Options
The following packaging options are mainly interesting for automation or integration with CI/CD pipelines:

ANDROID_APK_OUTPUT_DIR

Specifies a folder where the generated APK files should be placed.

ANDROID_FASTLANE_METADATA_OUTPUT_DIR

Specifies a folder where the generated metadata for the F-Droid store should be placed.

ANDROIDDEPLOYQT_EXTRA_ARGS

Allows to pass additional arguments to androiddeployqt. This is an alternative to the ARGS= argument for make and unlike that works with all CMake generators.

## SEE ALSO
ecm(7)

## COPYRIGHT
KDE Developers


fdupes-help

package: fdupes

title: fdupes-help(7)

summary: fdupes interactive mode reference

text:
# fdupes-help(7)

## NAME
fdupes-help - fdupes interactive mode reference

## INTRODUCTION
When run interactively (as fdupes --delete), fdupes will show a list of duplicates and prompt the user for further action.

The user can tell fdupes which files to keep or delete by tagging them accordingly. Once tagged, the user can instruct fdupes to delete any files that have been tagged for deletion. This can be done incrementally, if desired, successively tagging and deleting a limited number of files at a time until no more duplicates remain to be processed.

There are several ways to tag files in fdupes: individually using the cursor, by providing a list of files to keep, or by selecting files that match particular search criteria and tagging those as desired. Each of these approaches is discussed in detail in the sections below.

## SCROLLING THE LIST
The list of duplicates can be scrolled as follows:

PAGE DOWN

Scroll down to the next page.

PAGE UP

Scroll up to preceding page.

SHIFT + DOWN

Scroll down by one line. Not supported on some terminals.

SHIFT + UP

Scroll up by one line. Not supported on some terminals.

## MOVING THE CURSOR
The cursor tells fdupes which file and/or set of duplicates to act on, as described in the next section. The cursor's position can be changed as follows:

DOWN

Advance cursor to the next file on the list.

UP

Move cursor back to the previous file.

TAB

Advance cursor to the next set of duplicates.

BACKSPACE

Move cursor back to the previous set.

F3

Advance cursor to the next selected set, if any.

F2

Move cursor back to the previous selected set, if any.

It is also possible to jump directly to a particular set:

'goto <index>'

Move cursor to the top of the set indicated by index.

## TAGGING FILES USING THE CURSOR
Individual files can be tagged using the keys below. These keys all act on the current file, as identified by the cursor.

SHIFT + RIGHT

Tag current file for keeping.

SHIFT + LEFT

Tag current file for deletion.

'?'

Remove tag from current file.

Entire sets of files can be tagged by providing a list of indices in a comma-separated list. Files in the current set whose indices appear on the list will be tagged for keeping, while any other files in that set will be tagged for deletion. As with individual files, the current set is identified by the cursor.

As an example, given the following list of duplicates:

Set 1 of 5:

1 [ ] path/to/file_a

2 [ ] path/to/file_b

3 [ ] path/to/file_c

Typing '1, 3' at the prompt and pressing ENTER will tell fdupes to tag file_a and file_c for keeping, and file_b for deletion. The special command 'all' will tag all files for keeping.

There is one more command to deal with files in the current set:

'rg'

Remove tags from all files in current set.

## FILE SELECTION COMMANDS
Another way to tag files is to first select them according to particular search criteria and then tell fdupes what to do with them. The following commands can be used to select files for tagging:

'sel <text>'

Select any files whose paths contain the given text.

'selb <text>'

Select any files whose paths begin with the given text.

'sele <text>'

Select any files whose paths end with the given text.

'selm <text>'

Select any file whose path matches the given text exactly.

'selr <expression>'

Select any files whose paths match the given regular expression (see below).

'dsel <text>'

Deselect any files whose paths contain the given text.

'dselb <text>'

Deselect any files whose paths begin with the given text.

'dsele <text>'

Deselect any files whose paths end with the given text.

'dselm <text>'

Deselect any file whose path matches the given text exactly.

'dselr <expression>'

Deselect any files whose paths match the given regular expression (see below).

'csel'

Clear all selections.

'isel'

Invert selections within selected sets. For example, if files 1 and 4 in a set of 5 are selected, isel will deselect files 1 and 4, and select files 2, 3, and 5. Immediately repeating the same command will deselect files 2, 3, and 5, and select files 1 and 4, restoring selections to their previous state.

## TAGGING SELECTED FILES
Once some files have been selected using the commands described above, the following commands can be used to tag selected files as desired:

'ks'

Tag selected files for keeping.

'ds'

Tag selected files for deletion.

'rs'

Remove all tags from selected files.

## DELETING DUPLICATES
Once tagged for deletion, files can be deleted by pressing DELETE or using the 'prune' command. Fdupes will delete any files that are tagged for deletion and delist any sets whose remaining files have been tagged for keeping. For safety, fdupes will refuse to act on sets for which all files have been tagged for deletion. To handle these cases, tag at least one file for keeping and run the delete command again.

## OTHER COMMANDS
'exit', 'quit'

Exit the program.

'help'

Display this help text.

## REGULAR EXPRESSIONS
A regular expression is a sequence of characters defining a search pattern against which other character sequences can be compared. Strings of characters that follow the pattern defined by an expression are said to match the expression, whereas strings that break the pattern do not.

The syntax for regular expressions used by fdupes is known as the Perl Compatible Regular Expression syntax. A detailed description of regular expression syntax is beyond the scope of this document. For detailed information the user is encouraged to consult the PCRE2 documentation:

https://www.pcre.org/current/doc/html/pcre2syntax.html

Briefly, here are some examples of regular expressions:

abc123

Will match any string containing the sequence abc123, such as abc123, abc123x, xabc123, and xabc123x.

^abc123

Will match any string beginning with abc123, such as abc123 and abc123x, but not xabc123 or xabc123x. The character '^' has special meaning, telling the program to match only those strings that begin with the pattern that follows.

abc123$

Will match any string that ends with abc123, such as abc123 and xabc123, but not abc123x or xabc123x. The character '$' has special meaning, telling the program to match only those strings that end with the preceding pattern.

^abc123$

Will match the string abc123 and no other.

ab.123

Will match any string containing abc123 as in the first example, but it will also match strings containing abz123, ab0123, ab_123, etc. The character '.' has special meaning, acting as a placeholder that will match any character in that position.

^a.*3$

Will match any string beginning with the letter a and ending with the number 3, such as abc123, a3, and a0b1c2d3. Here the character '*' tells the program to accept any number of appearances (including none) for the preceding item (here, any character matching the placeholder character '.'). The characters '^' and '$' have the same meaning as in previous examples.

abc\d+

Will match any string containing the characters abc followed immediately by one or more decimal digits, such as abc123 and abc3210, but not abcd123 or abc 123 (note the space). Here \d is a placeholder for any decimal digit, while the character '+' tells the program to match one or more appearances of the preceding character or placeholder (here, \d).

\w+\d+

Will match any string containing one or more "word" characters followed immediately by one or more decimal digits, such as abc123 and abcd3210, but not abc 123 (note the space). Here \w is a placeholder for a "word" character, and \d and '+' have the same meaning as in the preceding example.

This is just scratching the surface of what can be done with regular expressions. Consult the PCRE2 documentation for a complete reference.

## SEE ALSO
The fdupes man page, fdupes(1).


foot-ctlseqs

package: foot

title: foot-ctlseqs(7)

text:
# foot-ctlseqs(7)

## NAME
foot-ctlseqs - terminal control sequences supported by foot

## DESCRIPTION
This document describes all the control sequences supported by foot.

•Control characters

•Sequences beginning with ESC

•CSI - Control Sequence Introducer

- SGR

- Indexed and RGB colors (256-color palette and 24-bit colors)

- Private modes

- Window manipulation

- Other

•OSC - Operating System Command

•DCS - Device Control String

## Control characters
Sequence

Name

Description

\a

BEL

Depends on what bell in foot.ini(5) is set to.

\b

BS

Backspace; move the cursor left one step. Wrap if bw is enabled.

\t

HT

Horizontal tab; move the cursor to the next tab stop.

\n

LF

Line feed; move the cursor down one step, or scroll content up if at the bottom line.

\v

VT

Vertical tab; identical to LF.

\f

FF

Form feed; identical to LF.

\r

CR

Carriage ret; move the cursor to the leftmost column.

\x0E

SO

Shift out; select the G1 character set.

\x0F

SI

Shift in; select the G0 character set.

## Sequences beginning with ESC
Note: this table excludes sequences where ESC is part of a 7-bit equivalent to 8-bit C1 controls.

Sequence

Name

Origin

Description

\E 7

DECSC

VT100

Save cursor position.

\E 8

DECRC

VT100

Restore cursor position.

\E c

RIS

VT100

Reset terminal to initial state.

\E D

IND

VT100

Line feed; move the cursor down one step, or scroll content up if at the bottom margin.

\E E

NEL

VT100

Next line; move the cursor down one step, and to the first column. Content is scrolled up if at the bottom line.

\E H

HTS

VT100

Set one horizontal tab stop at the current position.

\E M

RI

VT100

Reverse index; move the cursor up one step, or scroll content down if at the top margin.

\E N

SS2

VT220

Single shift select of G2 character set (affects next character only).

\E O

SS3

VT220

Single shift select of G3 character set (affects next character only).

\E =

DECKPAM

VT100

Switch keypad to application mode.

\E >

DECKPNM

VT100

Switch keypad to numeric mode.

\E ( C

SCS

VT100

Designate G0 character set. Supported values for C are: 0 (DEC Special Character and Line Drawing Set), and B (USASCII).

\E ) C

SCS

VT100

Designate G1 character set. Same supported values for C as in G0.

\E * C

SCS

VT220

Designate G2 character set. Same supported values for C as in G0.

\E + C

SCS

VT220

Designate G3 character set. Same supported values for C as in G0.

## CSI
All sequences begin with \E[, sometimes abbreviated "CSI". Spaces are used in the sequence strings to make them easier to read, but are not actually part of the string (i.e. \E[ 1 m is really \E[1m).

### SGR
All SGR sequences are in the form \E[ N m, where N is a decimal number - the parameter. Multiple parameters can be combined in a single CSI sequence by separating them with semicolons: \E[ 1;2;3 m.

Parameter

Description

0

Reset all attributes

1

Bold

2

Dim

3

Italic

4

Underline, including styled underlines

5

Blink

7

Reverse video; swap foreground and background colors

8

Conceal; text is not visible, but is copiable

9

Crossed-out/strike

21

Double underline

22

Disable bold and dim

23

Disable italic

24

Disable underline

25

Disable blink

27

Disable reverse video

28

Disable conceal

29

Disable crossed-out

30-37

Select foreground color (using regularN in foot.ini(5))

38

Select foreground color, see "indexed and RGB colors" below

39

Use the default foreground color (foreground in foot.ini(5))

40-47

Select background color (using regularN in foot.ini(5))

48

Select background color, see "indexed and RGB colors" below

49

Use the default background color (background in foot.ini(5))

58

Select underline color, see "indexed and RGB colors" below

59

Use the default underline color

90-97

Select foreground color (using brightN in foot.ini(5))

100-107

Select background color (using brightN in foot.ini(5))

### Indexed and RGB colors (256-color palette and 24-bit colors)
Foot supports both the new sub-parameter based variants, and the older parameter based variants for setting foreground and background colors.

Indexed colors:

•\E[ 38 : 5 : idx m

•\E[ 38 ; 5 ; idx m

RGB colors:

•\E[ 38 : 2 : cs : r : g : b m

•\E[ 38 : 2 : r : g : b m

•\E[ 38 ; 2 ; r ; g ; b m

The first variant is the "correct" one (and foot also recognizes, but ignores, the optional tolerance parameters).

The second one is allowed since many programs "forget" the color space ID, cs.

The sub-parameter based variants are preferred, and are what foot's terminfo(5) entry uses.

### Private Modes
There are several Boolean-like "modes" that affect certain aspects of the terminal's behavior. These modes can be manipulated with the following 4 escape sequences:

Sequence

Name

Description

\E[ ? Pm h

DECSET

Enable private mode

\E[ ? Pm l

DECRST

Disable private mode

\E[ ? Pm s

XTSAVE

Save private mode

\E[ ? Pm r

XTRESTORE

Restore private mode

The Pm parameter in the above sequences denotes a numerical ID that corresponds to one of the following modes:

Parameter

Origin

Description

1

VT100

Cursor keys mode (DECCKM)

5

VT100

Reverse video (DECSCNM)

6

VT100

Origin mode (DECOM)

7

VT100

Auto-wrap mode (DECAWM)

12

AT&T 610

Cursor blink

25

VT220

Cursor visibility (DECTCEM)

45

xterm

Reverse-wraparound mode

47

xterm

Same as 1047 (see below)

66

VT320

Numeric keypad mode (DECNKM); same as DECKPAM/DECKPNM when enabled/disabled

1000

xterm

Send mouse x/y on button press/release

1001

xterm

Use hilite mouse tracking

1002

xterm

Use cell motion mouse tracking

1003

xterm

Use all motion mouse tracking

1004

xterm

Send FocusIn/FocusOut events

1006

xterm

SGR mouse mode

1007

xterm

Alternate scroll mode

1015

urxvt

urxvt mouse mode

1016

xterm

SGR-Pixels mouse mode

1034

xterm

8-bit Meta mode

1035

xterm

Num Lock modifier (see xterm numLock option)

1036

xterm

Send ESC when Meta modifies a key (see xterm metaSendsEscape option)

1042

xterm

Perform action for BEL character (see bell in foot.ini(5))

1047

xterm

Use alternate screen buffer

1048

xterm

Save/restore cursor (DECSET=save, DECRST=restore)

1049

xterm

Equivalent to 1048 and 1047 combined

1070

xterm

Use private color registers for each sixel

2004

xterm

Wrap pasted text with start/end delimiters (bracketed paste mode)

2026

terminal-wg

Application synchronized updates mode

2027

contour

Grapheme cluster processing

2031

contour

Request color theme updates

2048

TODO

In-band window resize notifications

8452

xterm

Position cursor to the right of sixels, instead of on the next line

737769

foot

Input Method Editor (IME) mode

### Window manipulation
Foot implements a sub-set of XTerm's (originally dtterm's) window manipulation sequences. The generic format is:

\E[ Ps ; Ps ; Ps t

Parameter 1

Parameter 2

Description

11

-

Report if window is iconified. Foot always reports 1 - not iconified.

13

-

Report window position. Foot always reports (0,0), due to Wayland limitations.

13

2

Report text area position. Foot always reports (0,0) due to Wayland limitations.

14

-

Report text area size, in pixels. Foot reports the grid size, excluding the margins.

14

2

Report window size, in pixels. Foot reports the grid size plus the margins.

15

-

Report the screen size, in pixels.

16

-

Report the cell size, in pixels.

18

-

Report text area size, in characters.

19

-

Report screen size, in characters.

20

-

Report icon label.

22

-

Push window title+icon.

22

1

Push window icon.

22

2

Push window title.

23

-

Pop window title+icon.

23

1

Pop window icon.

23

2

Pop window title.

### Other
Parameter

Name

Origin

Description

\E[ Ps c

DA

VT100

Send primary device attributes. Foot responds with "I'm a VT220 with sixel and ANSI color support".

\E[ Ps A

CUU

VT100

Cursor up - move cursor up Ps times.

\E[ Ps B

CUD

VT100

Cursor down - move cursor down Ps times.

\E[ Ps C

CUF

VT100

Cursor forward - move cursor to the right Ps times.

\E[ Ps D

CUB

VT100

Cursor backward - move cursor to the left Ps times.

\E[ Ps g

TBC

VT100

Tab clear. Ps=0 -> clear current column. Ps=3 -> clear all.

\E[ Ps ; Ps f

HVP

VT100

Horizontal and vertical position - move cursor to row ; column.

\E[ Ps ; Ps H

CUP

VT100

Cursor position - move cursor to row ; column.

\E[ Ps J

ED

VT100

Erase in display. Ps=0 -> below cursor. Ps=1 -> above

\E[ Ps K

EL

VT100

Erase in line. Ps=0 -> right of cursor. Ps=1 -> left of cursor. Ps=2 -> all.

\E[ Pm h

SM

VT100

Set mode. Pm=4 -> enable IRM (Insertion Replacement Mode). All other values of Pm are unsupported.

\E[ Pm l

RM

VT100

Reset mode. Pm=4 -> disable IRM (Insertion Replacement Mode). All other values of Pm are unsupported.

\E[ Ps n

DSR

VT100

Device status report. Ps=5 -> device status. Ps=6 -> cursor position.

\E[ Ps L

IL

VT220

Insert Ps lines.

\E[ Ps M

DL

VT220

Delete Ps lines.

\E[ Ps P

DCH

VT220

Delete Ps characters.

\E[ Ps @

ICH

VT220

Insert Ps blank characters.

\E[ Ps X

ECH

VT220

Erase Ps characters.

\E[ > c

DA2

VT220

Send secondary device attributes. Foot responds with "I'm a VT220 and here's my version number".

\E[ ! p

DECSTR

VT220

Soft terminal reset.

\E[ ? Ps $ p

DECRQM

VT320

Request status of DEC private mode. The Ps parameter corresponds to one of the values mentioned in the "Private Modes" section above (as set with DECSET/DECRST).

\E[ Ps $ p

DECRQM

VT320

Request status of ECMA-48/ANSI mode. See the descriptions for SM/RM above for recognized Ps values.

\E[ Pt ; Pl ; Pb ; Pr ; Pm $ r

DECCARA

VT400

Change attributes in rectangular area. Pt, Pl, Pb and Pr denotes the rectangle, Pm denotes the SGR attributes.

\E[ Pt ; Pl ; Pb ; Pr ; Pm $ t

DECRARA

VT400

Invert attributes in rectangular area. Pt, Pl, Pb and Pr denotes the rectangle, Pm denotes the SGR attributes.

\E[ Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ v

DECCRA

VT400

Copy rectangular area. Pt, Pl, Pb and Pr denotes the rectangle, Pt and Pl denotes the target location.

\E[ Pc ; Pt ; Pl ; Pb ; Pr $ x

DECFRA

VT420

Fill rectangular area. Pc is the character to use, Pt, Pl, Pb and Pr denotes the rectangle.

\E[ Pt ; Pl ; Pb ; Pr $ z

DECERA

VT400

Erase rectangular area. Pt, Pl, Pb and Pr denotes the rectangle.

\E[ Ps T

SD

VT420

Scroll down Ps lines.

\E[ s

SCOSC

SCO, VT510

Save cursor position.

\E[ u

SCORC

SCO, VT510

Restore cursor position.

\E[ Ps SP q

DECSCUSR

VT510

Set cursor style. In foot, Ps=0 means "use style from foot.ini".

\E[ = Ps c

DA3

VT510

Send tertiary device attributes. Foot responds with "FOOT", in hexadecimal.

\E[ Pm d

VPA

ECMA-48

Line position absolute - move cursor to line Pm.

\E[ Pm e

VPR

ECMA-48

Line position relative - move cursor down Pm lines.

\E[ Pm a

HPR

ECMA-48

Character position relative - move cursor to the right Pm times.

\E[ Ps E

CNL

ECMA-48

Cursor next line - move the cursor down Ps times.

\E[ Ps F

CPL

ECMA-48

Cursor preceding line - move the cursor up Ps times.

\E[ Pm `

HPA

ECMA-48

Character position absolute - move cursor to column Pm.

\E[ Ps G

CHA

ECMA-48

Cursor character absolute - move cursor to column Ps. cursor. Ps=2 -> all. Ps=3 -> saved lines.

\E[ Ps S

SU

ECMA-48

Scroll up Ps lines.

\E[ Ps I

CHT

ECMA-48

Cursor forward tabulation Ps tab stops.

\E[ Ps Z

CBT

ECMA-48

Cursor backward tabulation Ps tab stops.

\E[ Ps b

REP

ECMA-48

Repeat the preceding printable character Ps times.

\E[ ? Pi ; Pa ; Pv S

XTSMGRAPHICS

xterm

Set or request sixel attributes.

\E[ > Ps q

XTVERSION

xterm

Ps=0 -> report terminal name and version, in the form \EP>|foot(version)\E\.

\E[ > 4 ; Pv m

XTMODKEYS

xterm

Set level of the modifyOtherKeys property to Pv. Note that foot only supports level 1 and 2, where level 1 is the default setting.

\E[ ? Pp m

XTQMODKEYS

xterm

Query key modifier options

\E[ > 4 n

<unnamed>

xterm

Resets the modifyOtherKeys property to level 1. Note that in foot, this sequence does not completely disable modifyOtherKeys, since foot only supports level 1 and level 2 (and not level 0).

\E[ ? u

<unnamed>

kitty

Query current values of the Kitty keyboard flags.

\E[ > flags u

<unnamed>

kitty

Push a new entry, flags, to the Kitty keyboard stack.

\E[ < number u

<unnamed>

kitty

Pop number of entries from the Kitty keyboard stack.

\E[ = flags ; mode u

<unnamed>

kitty

Update current Kitty keyboard flags, according to mode.

\E[ # P

XTPUSHCOLORS

xterm

Push current color palette onto stack

\E[ # Q

XTPOPCOLORS

xterm

Pop color palette from stack

\E[ # R

XTREPORTCOLORS

xterm

Report the current entry on the palette stack, and the number of palettes stored on the stack.

\E[ ? 996 n

Query the current (color) theme mode

contour

The current color theme mode (light or dark) is reported as CSI ? 997 ; 1|2 n, where 1 means dark and 2 light. By convention, the primary theme in foot is considered dark, and the alternative theme light.

## OSC
All OSC sequences begin with \E], sometimes abbreviated OSC.

Sequence

Origin

Description

\E] 0 ; Pt \E\

xterm

Set window icon and title to Pt.

\E] 1 ; Pt \E\

xterm

Set window icon to Pt.

\E] 2 ; Pt \E\

xterm

Set window title to Pt

\E] 4 ; c ; spec \E\

xterm

Change color number c to spec, where spec is a color in XParseColor format. foot only supports RGB colors; either rgb:<red>/<green>/<blue>, or the legacy format (#rgb).

\E] 7 ; Uri \E\

iTerm2

Update the terminal's current working directory. Newly spawned terminals will launch in this directory. Uri must be in the format file://<hostname>/<path>. hostname must refer to your local host.

\E] 8 ; id=ID ; Uri \E\

VTE+iTerm2

Hyperlink (a.k.a HTML-like anchors). id=ID is optional; if assigned, all URIs with the same ID will be treated as a single hyperlink. An empty URI closes the hyperlink.

\E] 9 ; msg \E\

iTerm2

Desktop notification, uses notify in foot.ini(5).

\E] 10 ; spec \E\

xterm

Change the default foreground color to spec, a color in XParseColor format.

\E] 11 ; spec \E\

xterm

Change the default background color to spec, a color in XParseColor format. Foot implements URxvt's transparency extension; e.g. spec=[75]#ff00ff or spec=rgba:ff/00/ff/bf (pink with 75% alpha).

\E] 12 ; spec \E\

xterm

Change cursor color to spec, a color in XParseColor format.

\E] 17 ; spec \E\

xterm

Change selection background color to spec, a color in XParseColor format.

\E] 19 ; spec \E\

xterm

Change selection foreground color to spec, a color in XParseColor format.

\E] 22 ; xcursor-pointer-name \E\

xterm

Sets the xcursor pointer. An empty name, or an invalid name resets it.

\E] 52 ; Pc ; ? \E\

xterm

Send clipboard data. Pc can be either c, s or p. c uses the clipboard as source, and s and p uses the primary selection. The response is \E] 52 ; Pc ; <base64-encoded data> E\, where Pc denotes the source used.

\E] 52 ; Pc ; Pd \E\

xterm

Copy Pd (base64 encoded text) to the clipboard. Pc denotes the target: c targets the clipboard and s and p the primary selection.

\E] 66 ; params ; text \E\

kitty

Text sizing protocol (only 'w', width, supported)

\E] 99 ; params ; payload \E\

kitty

Desktop notification; uses desktop-notifications.command in foot.ini(5).

\E] 104 ; c \E\

xterm

Reset color number c (multiple semicolon separated c values may be provided), or all colors (excluding the default foreground/background colors) if c is omitted.

\E] 110 \E\

xterm

Reset default foreground color

\E] 111 \E\

xterm

Reset default background color

\E] 112 \E\

xterm

Reset cursor color

\E] 117 \E\

xterm

Reset selection background color

\E] 119 \E\

xterm

Reset selection foreground color

\E] 133 ; A \E\

FinalTerm

Mark start of shell prompt

\E] 133 ; C \E\

FinalTerm

Mark start of command output

\E] 133 ; D \E\

FinalTerm

Mark end of command output

\E] 176 ; app-id \E\

foot

Set app ID. app-id is optional; if assigned, the terminal window App ID will be set to the value. An empty App ID resets the value to the default.

\E] 555 \E\

foot

Flash the entire terminal (foot extension)

\E] 777;notify;title;msg \E\

urxvt

Desktop notification, uses desktop-notifications.command in foot.ini(5).

## DCS
All DCS sequences begin with \EP (sometimes abbreviated DCS), and are terminated by \E\ (ST).

Sequence

Description

\EP q <sixel data> \E\

Emit a sixel image at the current cursor position

\EP $ q <query> \E\

Request selection or setting (DECRQSS). Implemented queries: DECSTBM, SGR and DECSCUSR.

\EP = C s \E\

Begin (C=1) or end (C=2) application synchronized updates. This sequence is supported for compatibility reasons, but it's recommended to use private mode 2026 (see above) instead.

\EP + q <hex encoded capability name> \E\

Query builtin terminfo database (XTGETTCAP)

## FOOTNOTE
Foot does not support 8-bit control characters ("C1").


freeipmi

package: freeipmi

title: freeipmi(7)

text:
# freeipmi(7)

## NAME
FreeIPMI - FreeIPMI overview

## Introduction
FreeIPMI provides in-band and out-of-band IPMI software based on the IPMI v1.5/2.0 specification.

## What is IPMI?
The IPMI specification defines a set of interfaces for platform management and is implemented by a number vendors for system management. The features of IPMI that most users will be interested in are sensor monitoring, system event monitoring, power control, and serial-over-LAN (SOL). The FreeIPMI tools and libraries listed below should provide users with the ability to access and utilize these and many other features of IPMI.

## Getting Started with IPMI
IPMI can be used in-band (i.e. running on a machine locally) or out-of-band (i.e. connecting remotely).

Most FreeIPMI tools can operate in-band by using one of the in-band drivers included. These in-band drivers include a userspace KCS interface driver, a SSIF driver through the Linux SSIF device (i.e. /dev/i2c-0), the OpenIPMI Linux kernel driver (i.e. /dev/ipmi0), the Sun/Solaris BMC driver (i.e. /dev/bmc), and the Intel DCMI/MEI driver (i.e. /dev/dcmi). If your system requires the use of installed drivers, those appropriate modules must be installed ahead of time. However, most systems should automatically load these drivers when appropriate.

Under most scenarios, the FreeIPMI tools should automatically discover which in-band interface to use and the proper settings to use. Users may execute the tools on the command line to begin using them. Some motherboards may require you to determine driver type, addresses, paths, etc. on your own and pass them as command line options to the tools. You may use ipmi-locate(8) to help determine this information. Other tools such as dmidecode(8) may also provide this information.

To use IPMI out-of-band with tools such as ipmipower(8) or ipmi-sensors(8), the remote machine's BMC must first be configured for out of band communication. Typically, this involves setting a username, password, IP address, MAC address, and a few other parameters. This can be done using the tool ipmi-config(8). Additional information on how to configure with ipmi-config(8) can be found in the ipmi-config.conf(5) manpage. Some vendors may pre-configure their motherboards with default values so that ipmi-config(8) can be used remotely to configure the machine. However, most of the time, the BMC must be configured in-band before out-of-band access can be allowed (for example, the correct IP address and MAC address must be configured).

In order to remotely connect to a machine, you typically must specify the host, username, and password for the tool in order to connect. Depending on configuration settings, a K_g key, privilege level, authentication type, cipher suite id, or protocol version may need to be specified.

Some vendors may have not implemented IPMI properly and a workaround must be specified into FreeIPMI to ensure the tool can execute properly. For example, a fair number of vendors have populated their FRU records with invalid checksums. To properly ignore these set of checksums a skipchecks workaround has been added to ipmi-fru(8). Please see each of the tool manpages to see a list of available workarounds.

Additional information, examples, and general trouble-shooting can be found in each of the tool manpages.

## General Use
The primary tools that most users of FreeIPMI will be interested in for system management are the following:

ipmi-sensors

A tool to read IPMI sensor readings to aid in system monitoring.

ipmi-sel

A tool to read and manage IPMI System Event Log (SEL) records to aid in system debugging.

ipmipower

A tool for remote power control.

ipmiconsole

A tool for Serial-over-Lan (SOL) console access.

Many other tools and libraries are listed below that cover additional features and areas of IPMI.

Additional information, examples, and general trouble-shooting can be found in each of the tool manpages.

## Configuration
In order to avoid typing in a long list of command line options to specify IPMI communication requirements every time a command is executed (e.g. driver paths, usernames, passwords, etc.), an alternate set of default values can be set for most FreeIPMI tools in the FreeIPMI configuration file. See freeipmi.conf(5) for more information.

## HPC Support
Much of FreeIPMI was written with HPC support in mind. Ipmi-config(8) comes with file input/output support so that configuration can be copied and verified across nodes in a cluster. Most tools (like ipmipower(8) and ipmi-sensors(8) ) come with hostrange support so multiple hosts can be specified on the command line at the same time and IPMI can be executed against the hosts in parallel. See tool manpages for more information. Also see the document freeipmi-hostrange.txt for detailed usage and explanation. Ipmi-sensors(8) and the libipmimonitoring(3) library support the ability to interpret sensor readings as well as just reporting them. By mapping sensor readings into NOMINAL, WARNING, or CRITICAL states, it makes monitoring sensors easier across large numbers of nodes.

## Development
For information on the libraries that can be used to program IPMI applications with, please see libfreeipmi(3), libipmiconsole(3), libipmimonitoring(3), and libipmidetect(3). Or see the document freeipmi-libraries.txt.

## Project Tools
The following tools are distributed and supported by FreeIPMI.

bmc-info

A tool to read information about a BMC such as device version numbers, device support, and globally unique IDs (guids).

bmc-watchdog

A tool/daemon to manage a BMC Watchdog. This tool is typically used for system timeout management and automatic system restarts in the event of a system crash.

ipmi-chassis

A tool to manage/monitor a chassis, such as chassis power, identification (i.e. LED control), and status.

ipmi-fru

A tool to read field replaceable unit (FRU) information from a motherboard/machine.

ipmi-sel

A tool to read and manage IPMI System Event Log (SEL) records. SEL records store system event information and may be useful for debugging problems.

ipmi-sensors

A tool to read IPMI sensor readings and sensor data repository (SDR) information.

ipmipower

A tool for remote power control.

ipmiconsole

A tool for Serial-over-Lan (SOL) console access.

ipmi-config

A tool to configure BMC and IPMI information. In can be used to configured usernames, passwords, networking information, security, Serial-over-LAN (SOL), Platform Event Filtering (PEF), boot devices, power restoration policy, sensor thresholds, sensor events, and many more configuration options.

ipmi-raw

A tool that provides hex input/output of IPMI commands.

ipmi-locate

A tool that can probe for information about the location of a BMC device, such as device addresses.

ipmi-pet

A tool to parse and interpret Platform Event Traps (PET).

ipmi-dcmi

A tool to perform Data Center Manageability Interface (DCMI) IPMI extension commands. Supports extensions for asset management and power usage management.

bmc-device

A tool to perform advanced BMC commands, such as resetting the BMC, configuring ACPI, configuring SDR/SEL time, manually generating events, re-arming sensors, and configuring manufacturer settings.

ipmiping

An IPMI ping tool for debugging.

rmcpping

A RMCP ping tool for debugging.

ipmi-oem

An IPMI tool for OEM specific commands.

ipmidetect/ipmidetectd

A tool and daemon for IPMI node detection.

ipmiseld

A daemon that regularly polls the SEL and stores the events to the local syslog.

Additional information, examples, and general trouble-shooting can be found in each of the tool manpages.

## Project Libraries
The following libraries are distributed and supported by FreeIPMI.

libfreeipmi

A C library that includes KCS, SSIF, and OpenIPMI Linux, and Solaris BMC drivers, IPMI 1.5 and IPMI 2.0 LAN communication interfaces, IPMI packet building utilities, IPMI command utilities, and utilities for reading/interpreting/managing IPMI. This library is for programmers intimately familiar with the IPMI protocol and IPMI specification. Most users may wish to use the libraries listed below.

libipmiconsole

A library for Serial-over-Lan (SOL) console access. SOL console access is abstracted into a file descriptor interface, so users may read and write console data through a file descriptor.

libipmimonitoring

A library for sensor and system event log (SEL) monitoring that abstracts away most IPMI details. Interpretation of those sensors and events is abstracted into an API with an iterator interface.

libipmidetect

A library for IPMI node detection.

## REPORTING BUGS
Report bugs to <freeipmi-users@gnu.org> or <freeipmi-devel@gnu.org>.

## COPYRIGHT
Copyright © 2003-2015 FreeIPMI Core Team.

FreeIPMI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

## SEE ALSO
libfreeipmi(3), libipmiconsole(3), libipmidetect(3), libipmimonitoring(3), freeipmi.conf(5), bmc-device(8), bmc-info(8), bmc-watchdog(8), ipmi-chassis(8), ipmi-config(8), ipmi-fru(8), ipmi-locate(8), ipmi-oem(8), ipmi-pet(8), ipmi-raw(8), ipmi-sel(8), ipmi-sensors(8), ipmiconsole(8), ipmidetect(8), ipmiping(8), ipmipower(8), rmcpping(8)

http://www.gnu.org/software/freeipmi/


gammu-smsd-dbi

package: gammu

title: gammu-smsd-dbi(7)

text:
# gammu-smsd-dbi(7)

## NAME
gammu-smsd-dbi - gammu-smsd(1) backend using DBI abstraction layer to use any supported database as a message storage

## DESCRIPTION
DBI backend stores all data in any database supported by libdbi, which parameters are defined by configuration (see gammu-smsdrc for description of configuration options).

For tables description see gammu-smsd-tables.

This backend is based on gammu-smsd-sql.

NOTE:

The DBI driver is currently not supported on Windows because libdbi library does not support this platform.

## CONFIGURATION
Before running gammu-smsd you need to create necessary tables in the database. You can use examples given in database specific backends parts of this manual to do that.

The configuration file then can look like:

```
[smsd]
service = sql
driver = DBI_DRIVER
host = localhost
```

SEE ALSO:

gammu-smsdrc

## SUPPORTED DRIVERS
For complete list of drivers for libdbi see libdbi-drivers project. The drivers for example include:

- sqlite3 - for SQLite 3

- mysql - for MySQL

- pgsql - for PostgeSQL

- freetds - for MS SQL Server or Sybase

## CREATING TABLES FOR SQLITE
SQL script for creating tables in SQLite database:

```
CREATE TABLE gammu (

  Version INTEGER NOT NULL DEFAULT '0' PRIMARY KEY
);
INSERT INTO gammu (Version) VALUES (17);
CREATE TABLE inbox (

  UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  ReceivingDateTime NUMERIC NOT NULL DEFAULT (datetime('now')),

  Text TEXT NOT NULL,

  SenderNumber TEXT NOT NULL DEFAULT '',

  Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',

  UDH TEXT NOT NULL,

  SMSCNumber TEXT NOT NULL DEFAULT '',

  Class INTEGER NOT NULL DEFAULT '-1',

  TextDecoded TEXT NOT NULL DEFAULT '',

  ID INTEGER PRIMARY KEY AUTOINCREMENT,

  RecipientID TEXT NOT NULL,

  Processed TEXT NOT NULL DEFAULT 'false',

  Status INTEGER NOT NULL DEFAULT '-1',

  CHECK (Coding IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression'))
);
CREATE TRIGGER update_inbox_time UPDATE ON inbox

  BEGIN

    UPDATE inbox SET UpdatedInDB = datetime('now') WHERE ID = old.ID;

  END;
CREATE TABLE outbox (

  UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  SendingDateTime NUMERIC NOT NULL DEFAULT (datetime('now')),

  SendBefore time NOT NULL DEFAULT '23:59:59',

  SendAfter time NOT NULL DEFAULT '00:00:00',

  Text TEXT,

  DestinationNumber TEXT NOT NULL DEFAULT '',

  Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',

  UDH TEXT,

  Class INTEGER DEFAULT '-1',

  TextDecoded TEXT NOT NULL DEFAULT '',

  ID INTEGER PRIMARY KEY AUTOINCREMENT,

  MultiPart TEXT NOT NULL DEFAULT 'false',

  RelativeValidity INTEGER DEFAULT '-1',

  SenderID TEXT,

  SendingTimeOut NUMERIC NOT NULL DEFAULT (datetime('now')),

  DeliveryReport TEXT DEFAULT 'default',

  CreatorID TEXT NOT NULL,

  Retries INTEGER DEFAULT '0',

  Priority INTEGER DEFAULT '0',

  Status TEXT NOT NULL DEFAULT 'Reserved',

  StatusCode INTEGER NOT NULL DEFAULT '-1',

  CHECK (Coding IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),

  CHECK (DeliveryReport IN ('default','yes','no')),

  CHECK (Status IN

  ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',

  'DeliveryUnknown','Error','Reserved'))
);
CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
CREATE INDEX outbox_sender ON outbox(SenderID);
CREATE TRIGGER update_outbox_time UPDATE ON outbox

  BEGIN

    UPDATE outbox SET UpdatedInDB = datetime('now') WHERE ID = old.ID;

  END;
CREATE TABLE outbox_multipart (

  Text TEXT,

  Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',

  UDH TEXT,

  Class INTEGER DEFAULT '-1',

  TextDecoded TEXT DEFAULT NULL,

  ID INTEGER,

  SequencePosition INTEGER NOT NULL DEFAULT '1',

  Status TEXT NOT NULL DEFAULT 'Reserved',

  StatusCode INTEGER NOT NULL DEFAULT '-1',

  CHECK (Coding IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),

  CHECK (Status IN

  ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',

  'DeliveryUnknown','Error','Reserved')),

 PRIMARY KEY (ID, SequencePosition)
);
CREATE TABLE phones (

  ID TEXT NOT NULL,

  UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  TimeOut NUMERIC NOT NULL DEFAULT (datetime('now')),

  Send TEXT NOT NULL DEFAULT 'no',

  Receive TEXT NOT NULL DEFAULT 'no',

  IMEI TEXT PRIMARY KEY NOT NULL,

  IMSI TEXT NOT NULL,

  NetCode TEXT DEFAULT 'ERROR',

  NetName TEXT DEFAULT 'ERROR',

  Client TEXT NOT NULL,

  Battery INTEGER NOT NULL DEFAULT -1,

  Signal INTEGER NOT NULL DEFAULT -1,

  Sent INTEGER NOT NULL DEFAULT 0,

  Received INTEGER NOT NULL DEFAULT 0
);
CREATE TRIGGER update_phones_time UPDATE ON phones

  BEGIN

    UPDATE phones SET UpdatedInDB = datetime('now') WHERE IMEI = old.IMEI;

  END;
CREATE TABLE sentitems (

  UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime('now')),

  SendingDateTime NUMERIC NOT NULL DEFAULT (datetime('now')),

  DeliveryDateTime NUMERIC NULL,

  Text TEXT NOT NULL,

  DestinationNumber TEXT NOT NULL DEFAULT '',

  Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',

  UDH TEXT NOT NULL,

  SMSCNumber TEXT NOT NULL DEFAULT '',

  Class INTEGER NOT NULL DEFAULT '-1',

  TextDecoded TEXT NOT NULL DEFAULT '',

  ID INTEGER,

  SenderID TEXT NOT NULL,

  SequencePosition INTEGER NOT NULL DEFAULT '1',

  Status TEXT NOT NULL DEFAULT 'SendingOK',

  StatusError INTEGER NOT NULL DEFAULT '-1',

  TPMR INTEGER NOT NULL DEFAULT '-1',

  RelativeValidity INTEGER NOT NULL DEFAULT '-1',

  CreatorID TEXT NOT NULL,

  StatusCode INTEGER NOT NULL DEFAULT '-1',

  CHECK (Status IN

  ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',

  'DeliveryUnknown','Error')),

  CHECK (Coding IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')) ,

  PRIMARY KEY (ID, SequencePosition)
);
CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
CREATE INDEX sentitems_sender ON sentitems(SenderID);
CREATE TRIGGER update_sentitems_time UPDATE ON sentitems

  BEGIN

    UPDATE sentitems SET UpdatedInDB = datetime('now') WHERE ID = old.ID;

  END;
```

NOTE:

You can find the script in docs/sql/sqlite.sql as well. There are also scripts for other databases in same folder.

## UPGRADING TABLES
The easiest way to upgrade database structure is to backup old one and start with creating new one based on example above.

For upgrading existing database, you can use changes described in smsd-tables-history and then manually update Version field in gammu table.

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-files

title: gammu-smsd-files(7)

text:
# gammu-smsd-files(7)

## NAME
gammu-smsd-files - gammu-smsd(1) backend using filesystem as a message storage

## DESCRIPTION
FILES backend stores all data on a filesystem in folders defined by configuration (see gammu-smsdrc for description of configuration options).

## RECEIVING OF MESSAGES
Received messages are stored in a folder defined by configuration. The filename will be IN<date>_<time>_<serial>_<sender>_<sequence>.<ext>, for example IN20021130_021531_00_+45409000931640979_00.txt.

Explanation of fields:

<date>

date in format YYYYMMDD

<time>

time in format HHMMSS

<sender>

sender number

<serial>

order of a message (in case more messages were received at same time), in format NN

<sequence>

part of the message for multipart messages, in format NN

<ext>

txt for text message, 8-bit messages are stored with bin extension, smsbackup for gammu-smsbackup

The content of the file is content of the message and the format is defined by configuration directive InboxFormat (see gammu-smsdrc).

## TRANSMITTING OF MESSAGES
Transmitted messages are read from a folder defined by configuration. The filename should be one of the following formats:

- OUT<recipient>.<ext>

- OUT<priority>_<recipient>_<serial>.<ext>

- OUT<priority><date>_<time>_<serial>_<recipient>_<note>.<ext>

Explanation of fields:

<recipient>

recipient number where to send message

<priority>

an alphabetic character (A-Z) A = highest priority

<ext>

txt for normal text SMS, smsbackup for gammu-smsbackup

<note>

any arbitrary text which is ignored

For text messages, you can additionally append flags to extension:

d

delivery report requested

f

flash SMS

b

WAP bookmark as name,URL

Other fields are same as for received messages.

For example OUTG20040620_193810_123_+4512345678_xpq.txtdf is a flash text SMS requesting delivery reports.

SMSes will be transmitted sequentially based on the file name. The contents of the file is the SMS to be transmitted (in Unicode or standard character set).

The contents of the file is the SMS to be transmitted (in Unicode or standard character set), for WAP bookmarks it is split on as Name,URL, for text messages whole file content is used.

Please note that if file is not in Unicode, encoding is detected based on locales, which do not have to be configured if SMSD is running from init script. If this is your case, please add locales definition to init script.

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-mysql

title: gammu-smsd-mysql(7)

text:
# gammu-smsd-mysql(7)

## NAME
gammu-smsd-mysql - gammu-smsd(1) backend using MySQL database server as a message storage

## DESCRIPTION
MYSQL backend stores all data in a MySQL database server, which parameters are defined by configuration (see gammu-smsdrc for description of configuration options).

For tables description see gammu-smsd-tables.

This backend is based on gammu-smsd-sql.

## CONFIGURATION
Before running gammu-smsd you need to create necessary tables in the database, which is described below.

The configuration file then can look like:

```
[smsd]
service = sql
driver = native_mysql
host = localhost
```

SEE ALSO:

gammu-smsdrc

## PRIVILEGES
The user accessing the database does not need much privileges, the following privileges should be enough:

```
GRANT USAGE ON *.* TO 'smsd'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, UPDATE, DELETE ON `smsd`.* TO 'smsd'@'localhost';
CREATE DATABASE smsd;
```

NOTE:

For creating the SQL tables you need more privileges, especially for creating triggers, which are used for some functionality.

## CREATING TABLES FOR MYSQL
Depending on MySQL version and settings please choose best fitting script to create tables:

- mysql.sql, requires MySQL 5.6.5 or newer

- mysql-legacy.sql supports legacy MySQL versions, but requires neither of NO_ZERO_DATE, ANSI or STRICT modes to be set in the server

SQL script mysql.sql for creating tables in MySQL database:

```
--
-- Database for Gammu SMSD
--
-- In case you get errors about not supported charset, please
-- replace utf8mb4 with utf8.
-- --------------------------------------------------------
--
-- Table structure for table `gammu`
--
CREATE TABLE `gammu` (

  `Version` integer NOT NULL default '0' PRIMARY KEY
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `gammu`
--
INSERT INTO `gammu` (`Version`) VALUES (17);
-- --------------------------------------------------------
--
-- Table structure for table `inbox`
--
CREATE TABLE `inbox` (

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `ReceivingDateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `Text` text NOT NULL,

  `SenderNumber` varchar(20) NOT NULL default '',

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text NOT NULL,

  `SMSCNumber` varchar(20) NOT NULL default '',

  `Class` integer NOT NULL default '-1',

  `TextDecoded` text NOT NULL,

  `ID` integer unsigned NOT NULL auto_increment,

  `RecipientID` text NOT NULL,

  `Processed` enum('false','true') NOT NULL default 'false',

  `Status` integer NOT NULL default '-1',

  PRIMARY KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `inbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `outbox`
--
CREATE TABLE `outbox` (

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `InsertIntoDB` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `SendingDateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `SendBefore` time NOT NULL DEFAULT '23:59:59',

  `SendAfter` time NOT NULL DEFAULT '00:00:00',

  `Text` text,

  `DestinationNumber` varchar(20) NOT NULL default '',

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text,

  `Class` integer default '-1',

  `TextDecoded` text NOT NULL,

  `ID` integer unsigned NOT NULL auto_increment,

  `MultiPart` enum('false','true') default 'false',

  `RelativeValidity` integer default '-1',

  `SenderID` varchar(255),

  `SendingTimeOut` timestamp NULL default CURRENT_TIMESTAMP,

  `DeliveryReport` enum('default','yes','no') default 'default',

  `CreatorID` text NOT NULL,

  `Retries` int(3) default 0,

  `Priority` integer default 0,

  `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',

  `StatusCode` integer NOT NULL default '-1',

  PRIMARY KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
CREATE INDEX outbox_sender ON outbox(SenderID(250));
--
-- Dumping data for table `outbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `outbox_multipart`
--
CREATE TABLE `outbox_multipart` (

  `Text` text,

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text,

  `Class` integer default '-1',

  `TextDecoded` text,

  `ID` integer unsigned NOT NULL default '0',

  `SequencePosition` integer NOT NULL default '1',

  `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',

  `StatusCode` integer NOT NULL default '-1',

  PRIMARY KEY (`ID`, `SequencePosition`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `outbox_multipart`
--
-- --------------------------------------------------------
--
-- Table structure for table `phones`
--
CREATE TABLE `phones` (

  `ID` text NOT NULL,

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `InsertIntoDB` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `TimeOut` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `Send` enum('yes','no') NOT NULL default 'no',

  `Receive` enum('yes','no') NOT NULL default 'no',

  `IMEI` varchar(35) NOT NULL,

  `IMSI` varchar(35) NOT NULL,

  `NetCode` varchar(10) default 'ERROR',

  `NetName` varchar(35) default 'ERROR',

  `Client` text NOT NULL,

  `Battery` integer NOT NULL DEFAULT -1,

  `Signal` integer NOT NULL DEFAULT -1,

  `Sent` int NOT NULL DEFAULT 0,

  `Received` int NOT NULL DEFAULT 0,

  PRIMARY KEY (`IMEI`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `phones`
--
-- --------------------------------------------------------
--
-- Table structure for table `sentitems`
--
CREATE TABLE `sentitems` (

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `InsertIntoDB` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `SendingDateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,

  `DeliveryDateTime` timestamp NULL,

  `Text` text NOT NULL,

  `DestinationNumber` varchar(20) NOT NULL default '',

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text NOT NULL,

  `SMSCNumber` varchar(20) NOT NULL default '',

  `Class` integer NOT NULL default '-1',

  `TextDecoded` text NOT NULL,

  `ID` integer unsigned NOT NULL default '0',

  `SenderID` varchar(255) NOT NULL,

  `SequencePosition` integer NOT NULL default '1',

  `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error') NOT NULL default 'SendingOK',

  `StatusError` integer NOT NULL default '-1',

  `TPMR` integer NOT NULL default '-1',

  `RelativeValidity` integer NOT NULL default '-1',

  `CreatorID` text NOT NULL,

  `StatusCode` integer NOT NULL default '-1',

  PRIMARY KEY (`ID`, `SequencePosition`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
CREATE INDEX sentitems_sender ON sentitems(SenderID(250));
--
-- Dumping data for table `sentitems`
--
```

NOTE:

You can find the script in docs/sql/mysql.sql as well.

SQL script mysql-legacy.sql for creating tables in MySQL database:

```
--
-- Database for Gammu SMSD
--
-- In case you get errors about not supported charset, please
-- replace utf8mb4 with utf8.
-- --------------------------------------------------------
--
-- Table structure for table `gammu`
--
CREATE TABLE `gammu` (

  `Version` integer NOT NULL default '0' PRIMARY KEY
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `gammu`
--
INSERT INTO `gammu` (`Version`) VALUES (17);
-- --------------------------------------------------------
--
-- Table structure for table `inbox`
--
CREATE TABLE `inbox` (

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `ReceivingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',

  `Text` text NOT NULL,

  `SenderNumber` varchar(20) NOT NULL default '',

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text NOT NULL,

  `SMSCNumber` varchar(20) NOT NULL default '',

  `Class` integer NOT NULL default '-1',

  `TextDecoded` text NOT NULL,

  `ID` integer unsigned NOT NULL auto_increment,

  `RecipientID` text NOT NULL,

  `Processed` enum('false','true') NOT NULL default 'false',

  `Status` integer NOT NULL default '-1',

  PRIMARY KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `inbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `outbox`
--
CREATE TABLE `outbox` (

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',

  `SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',

  `SendBefore` time NOT NULL DEFAULT '23:59:59',

  `SendAfter` time NOT NULL DEFAULT '00:00:00',

  `Text` text,

  `DestinationNumber` varchar(20) NOT NULL default '',

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text,

  `Class` integer default '-1',

  `TextDecoded` text NOT NULL,

  `ID` integer unsigned NOT NULL auto_increment,

  `MultiPart` enum('false','true') default 'false',

  `RelativeValidity` integer default '-1',

  `SenderID` varchar(255),

  `SendingTimeOut` timestamp NULL default '0000-00-00 00:00:00',

  `DeliveryReport` enum('default','yes','no') default 'default',

  `CreatorID` text NOT NULL,

  `Retries` int(3) default 0,

  `Priority` integer default 0,

  `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',

  `StatusCode` integer NOT NULL default '-1',

  PRIMARY KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
CREATE INDEX outbox_sender ON outbox(SenderID(250));
--
-- Dumping data for table `outbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `outbox_multipart`
--
CREATE TABLE `outbox_multipart` (

  `Text` text,

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text,

  `Class` integer default '-1',

  `TextDecoded` text,

  `ID` integer unsigned NOT NULL default '0',

  `SequencePosition` integer NOT NULL default '1',

  `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',

  `StatusCode` integer NOT NULL default '-1',

  PRIMARY KEY (`ID`, `SequencePosition`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `outbox_multipart`
--
-- --------------------------------------------------------
--
-- Table structure for table `phones`
--
CREATE TABLE `phones` (

  `ID` text NOT NULL,

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',

  `TimeOut` timestamp NOT NULL default '0000-00-00 00:00:00',

  `Send` enum('yes','no') NOT NULL default 'no',

  `Receive` enum('yes','no') NOT NULL default 'no',

  `IMEI` varchar(35) NOT NULL,

  `IMSI` varchar(35) NOT NULL,

  `NetCode` varchar(10) default 'ERROR',

  `NetName` varchar(35) default 'ERROR',

  `Client` text NOT NULL,

  `Battery` integer NOT NULL DEFAULT -1,

  `Signal` integer NOT NULL DEFAULT -1,

  `Sent` int NOT NULL DEFAULT 0,

  `Received` int NOT NULL DEFAULT 0,

  PRIMARY KEY (`IMEI`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `phones`
--
-- --------------------------------------------------------
--
-- Table structure for table `sentitems`
--
CREATE TABLE `sentitems` (

  `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

  `InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',

  `SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',

  `DeliveryDateTime` timestamp NULL,

  `Text` text NOT NULL,

  `DestinationNumber` varchar(20) NOT NULL default '',

  `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',

  `UDH` text NOT NULL,

  `SMSCNumber` varchar(20) NOT NULL default '',

  `Class` integer NOT NULL default '-1',

  `TextDecoded` text NOT NULL,

  `ID` integer unsigned NOT NULL default '0',

  `SenderID` varchar(255) NOT NULL,

  `SequencePosition` integer NOT NULL default '1',

  `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error') NOT NULL default 'SendingOK',

  `StatusError` integer NOT NULL default '-1',

  `TPMR` integer NOT NULL default '-1',

  `RelativeValidity` integer NOT NULL default '-1',

  `CreatorID` text NOT NULL,

  `StatusCode` integer NOT NULL default '-1',

  PRIMARY KEY (`ID`, `SequencePosition`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
CREATE INDEX sentitems_sender ON sentitems(SenderID(250));
--
-- Dumping data for table `sentitems`
--
--
-- Triggers for setting default timestamps
--
DELIMITER //
CREATE TRIGGER inbox_timestamp BEFORE INSERT ON inbox
FOR EACH ROW
BEGIN

    IF NEW.ReceivingDateTime = '0000-00-00 00:00:00' THEN

        SET NEW.ReceivingDateTime = CURRENT_TIMESTAMP();

    END IF;
END;//
CREATE TRIGGER outbox_timestamp BEFORE INSERT ON outbox
FOR EACH ROW
BEGIN

    IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN

        SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();

    END IF;

    IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN

        SET NEW.SendingDateTime = CURRENT_TIMESTAMP();

    END IF;

    IF NEW.SendingTimeOut = '0000-00-00 00:00:00' THEN

        SET NEW.SendingTimeOut = CURRENT_TIMESTAMP();

    END IF;
END;//
CREATE TRIGGER phones_timestamp BEFORE INSERT ON phones
FOR EACH ROW
BEGIN

    IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN

        SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();

    END IF;

    IF NEW.TimeOut = '0000-00-00 00:00:00' THEN

        SET NEW.TimeOut = CURRENT_TIMESTAMP();

    END IF;
END;//
CREATE TRIGGER sentitems_timestamp BEFORE INSERT ON sentitems
FOR EACH ROW
BEGIN

    IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN

        SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();

    END IF;

    IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN

        SET NEW.SendingDateTime = CURRENT_TIMESTAMP();

    END IF;
END;//
DELIMITER ;
```

NOTE:

You can find the script in docs/sql/mysql-legacy.sql as well.

## UPGRADING TABLES
The easiest way to upgrade database structure is to backup old one and start with creating new one based on example above.

For upgrading existing database, you can use changes described in smsd-tables-history and then manually update Version field in gammu table.

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-null

title: gammu-smsd-null(7)

text:
# gammu-smsd-null(7)

## NAME
gammu-smsd-null - gammu-smsd(1) backend not storing messages

## DESCRIPTION
NULL backend does not store data at all. It could be useful in case you don't want to store messages at all and you want to process then in RunOnReceive handler.

## CONFIGURATION
The configuration file then can look like:

```
[smsd]
Service = null
RunOnReceive = /usr/local/bin/process-sms
```

SEE ALSO:

gammu-smsdrc

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-odbc

title: gammu-smsd-odbc(7)

text:
# gammu-smsd-odbc(7)

## NAME
gammu-smsd-odbc - gammu-smsd(1) backend using ODBC abstraction layer to use any supported database as a message storage

## DESCRIPTION
New in version 1.29.92.

ODBC backend stores all data in any database supported by ODBC, which parameters are defined by configuration (see gammu-smsdrc for description of configuration options).

For tables description see gammu-smsd-tables.

This backend is based on gammu-smsd-sql.

## SUPPORTED DRIVERS
On Microsoft Windows, Gammu uses native ODBC, on other platforms, unixODBC can be used.

## LIMITATIONS
Due to limits of the ODBC interface, Gammu can not reliably detect which SQL engine it is connected to.

In most cases this can be solved by setting SQL setting to correct dialect.

If that fails, you can also tweak the SQL queries to work in used SQL server, see SQL Queries for more details. Still you should set SQL to closest matching SQL dialect.

## CONFIGURATION
Before running gammu-smsd you need to create necessary tables in the database. You can use examples given in database specific backends parts of this manual to do that.

You specify data source name (DSN) as Host in gammu-smsdrc. The data source is configured depending on your platform.

NOTE:

Please remember that SMSD might be running in different context than your user (separate account on Linux or as as service on Windows), so the ODBC DSN needs to be configured as system wide in this case (system DSN on Windows or in global configuration on Linux).

On Microsoft Windows, you can find instructions on Microsoft website: https://support.microsoft.com/kb/305599

For unixODBC this is documented in the user manual: http://www.unixodbc.org/doc/UserManual/

## CREATING TABLES
Prior to starting SMSD you have to create tables it will use. Gammu ships SQL scripts for several databases to do that:

- mysql-create

- pgsql-create

- sqlite-create

## EXAMPLE
Example configuration:

```
[smsd]
service = sql
driver = odbc
host = dsn_of_your_database
sql = sql_variant_to_use
user = username
password = password
```

SEE ALSO:

gammu-smsdrc

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-pgsql

title: gammu-smsd-pgsql(7)

text:
# gammu-smsd-pgsql(7)

## NAME
gammu-smsd-pgsql - gammu-smsd(1) backend using PostgreSQL database server as a message storage

## DESCRIPTION
PGSQL backend stores all data in a PostgreSQL database server, which parameters are defined by configuration (see gammu-smsdrc for description of configuration options).

For tables description see gammu-smsd-tables.

This backend is based on gammu-smsd-sql.

## CONFIGURATION
Before running gammu-smsd you need to create necessary tables in the database, which is described below.

The configuration file then can look like:

```
[smsd]
service = sql
driver = native_pgsql
host = localhost
```

SEE ALSO:

gammu-smsdrc

## CREATING TABLES FOR POSTGRESQL
SQL script for creating tables in PostgreSQL database:

```
--
-- Database: "smsd"
--
-- CREATE USER "smsd" WITH NOCREATEDB NOCREATEUSER;
-- CREATE DATABASE "smsd" WITH OWNER = "smsd" ENCODING = 'UTF8';
-- \connect "smsd" "smsd"
-- COMMENT ON DATABASE "smsd" IS 'Gammu SMSD Database';
-- --------------------------------------------------------
--
-- Function declaration for updating timestamps
--
CREATE LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION update_timestamp() RETURNS trigger AS $update_timestamp$

  BEGIN

    NEW."UpdatedInDB" := LOCALTIMESTAMP(0);

    RETURN NEW;

  END;
$update_timestamp$ LANGUAGE plpgsql;
-- --------------------------------------------------------
--
-- Sequence declarations for tables' primary keys
--
--CREATE SEQUENCE inbox_ID_seq;
--CREATE SEQUENCE outbox_ID_seq;
--CREATE SEQUENCE outbox_multipart_ID_seq;
--CREATE SEQUENCE sentitems_ID_seq;
-- --------------------------------------------------------
--
-- Index declarations for tables' primary keys
--
--CREATE UNIQUE INDEX inbox_pkey ON inbox USING btree ("ID");
--CREATE UNIQUE INDEX outbox_pkey ON outbox USING btree ("ID");
--CREATE UNIQUE INDEX outbox_multipart_pkey ON outbox_multipart USING btree ("ID");
--CREATE UNIQUE INDEX sentitems_pkey ON sentitems USING btree ("ID");
-- --------------------------------------------------------
--
-- Table structure for table "gammu"
--
CREATE TABLE gammu (

  "Version" smallint NOT NULL DEFAULT '0' PRIMARY KEY
);
--
-- Dumping data for table "gammu"
--
INSERT INTO gammu ("Version") VALUES (17);
-- --------------------------------------------------------
--
-- Table structure for table "inbox"
--
CREATE TABLE inbox (

  "UpdatedInDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "ReceivingDateTime" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "Text" text NOT NULL,

  "SenderNumber" varchar(20) NOT NULL DEFAULT '',

  "Coding" varchar(255) NOT NULL DEFAULT 'Default_No_Compression',

  "UDH" text NOT NULL,

  "SMSCNumber" varchar(20) NOT NULL DEFAULT '',

  "Class" integer NOT NULL DEFAULT '-1',

  "TextDecoded" text NOT NULL DEFAULT '',

  "ID" serial PRIMARY KEY,

  "RecipientID" text NOT NULL,

  "Processed" boolean NOT NULL DEFAULT 'false',

  "Status" integer NOT NULL DEFAULT '-1',

  CHECK ("Coding" IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression'))
);
--
-- Dumping data for table "inbox"
--
-- --------------------------------------------------------
--
-- Create trigger for table "inbox"
--
CREATE TRIGGER update_timestamp BEFORE UPDATE ON inbox FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
-- --------------------------------------------------------
--
-- Table structure for table "outbox"
--
CREATE TABLE outbox (

  "UpdatedInDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "InsertIntoDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "SendingDateTime" timestamp NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "SendBefore" time NOT NULL DEFAULT '23:59:59',

  "SendAfter" time NOT NULL DEFAULT '00:00:00',

  "Text" text,

  "DestinationNumber" varchar(20) NOT NULL DEFAULT '',

  "Coding" varchar(255) NOT NULL DEFAULT 'Default_No_Compression',

  "UDH" text,

  "Class" integer DEFAULT '-1',

  "TextDecoded" text NOT NULL DEFAULT '',

  "ID" serial PRIMARY KEY,

  "MultiPart" boolean NOT NULL DEFAULT 'false',

  "RelativeValidity" integer DEFAULT '-1',

  "SenderID" varchar(255),

  "SendingTimeOut" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "DeliveryReport" varchar(10) DEFAULT 'default',

  "CreatorID" text NOT NULL,

  "Retries" integer DEFAULT '0',

  "Priority" integer DEFAULT '0',

  "Status" varchar(255) NOT NULL DEFAULT 'Reserved',

  "StatusCode" integer NOT NULL DEFAULT '-1',

  CHECK ("Coding" IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),

  CHECK ("DeliveryReport" IN ('default','yes','no')),

  CHECK ("Status" IN

  ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',

  'DeliveryUnknown','Error','Reserved'))
);
CREATE INDEX outbox_date ON outbox("SendingDateTime", "SendingTimeOut");
CREATE INDEX outbox_sender ON outbox("SenderID");
--
-- Dumping data for table "outbox"
--
-- --------------------------------------------------------
--
-- Create trigger for table "outbox"
--
CREATE TRIGGER update_timestamp BEFORE UPDATE ON outbox FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
-- --------------------------------------------------------
--
-- Table structure for table "outbox_multipart"
--
CREATE TABLE outbox_multipart (

  "Text" text,

  "Coding" varchar(255) NOT NULL DEFAULT 'Default_No_Compression',

  "UDH" text,

  "Class" integer DEFAULT '-1',

  "TextDecoded" text DEFAULT NULL,

  "ID" serial,

  "SequencePosition" integer NOT NULL DEFAULT '1',

  "Status" varchar(255) NOT NULL DEFAULT 'Reserved',

  "StatusCode" integer NOT NULL DEFAULT '-1',

  PRIMARY KEY ("ID", "SequencePosition"),

  CHECK ("Coding" IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),

  CHECK ("Status" IN

  ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',

  'DeliveryUnknown','Error','Reserved'))
);
--
-- Dumping data for table "outbox_multipart"
--
-- --------------------------------------------------------
--
-- Table structure for table "phones"
--
CREATE TABLE phones (

  "ID" text NOT NULL,

  "UpdatedInDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "InsertIntoDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "TimeOut" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "Send" boolean NOT NULL DEFAULT 'no',

  "Receive" boolean NOT NULL DEFAULT 'no',

  "IMEI" varchar(35) PRIMARY KEY NOT NULL,

  "IMSI" varchar(35) NOT NULL,

  "NetCode" varchar(10) DEFAULT 'ERROR',

  "NetName" varchar(35) DEFAULT 'ERROR',

  "Client" text NOT NULL,

  "Battery" integer NOT NULL DEFAULT -1,

  "Signal" integer NOT NULL DEFAULT -1,

  "Sent" integer NOT NULL DEFAULT 0,

  "Received" integer NOT NULL DEFAULT 0
);
--
-- Dumping data for table "phones"
--
-- --------------------------------------------------------
--
-- Create trigger for table "phones"
--
CREATE TRIGGER update_timestamp BEFORE UPDATE ON phones FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
-- --------------------------------------------------------
--
-- Table structure for table "sentitems"
--
CREATE TABLE sentitems (

  "UpdatedInDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "InsertIntoDB" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "SendingDateTime" timestamp(0) WITHOUT time zone NOT NULL DEFAULT LOCALTIMESTAMP(0),

  "DeliveryDateTime" timestamp(0) WITHOUT time zone NULL,

  "Text" text NOT NULL,

  "DestinationNumber" varchar(20) NOT NULL DEFAULT '',

  "Coding" varchar(255) NOT NULL DEFAULT 'Default_No_Compression',

  "UDH" text NOT NULL,

  "SMSCNumber" varchar(20) NOT NULL DEFAULT '',

  "Class" integer NOT NULL DEFAULT '-1',

  "TextDecoded" text NOT NULL DEFAULT '',

  "ID" serial,

  "SenderID" varchar(255) NOT NULL,

  "SequencePosition" integer NOT NULL DEFAULT '1',

  "Status" varchar(255) NOT NULL DEFAULT 'SendingOK',

  "StatusError" integer NOT NULL DEFAULT '-1',

  "TPMR" integer NOT NULL DEFAULT '-1',

  "RelativeValidity" integer NOT NULL DEFAULT '-1',

  "CreatorID" text NOT NULL,

  "StatusCode" integer NOT NULL DEFAULT '-1',

  CHECK ("Status" IN

  ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',

  'DeliveryUnknown','Error')),

  CHECK ("Coding" IN

  ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),

  PRIMARY KEY ("ID", "SequencePosition")
);
CREATE INDEX sentitems_date ON sentitems("DeliveryDateTime");
CREATE INDEX sentitems_tpmr ON sentitems("TPMR");
CREATE INDEX sentitems_dest ON sentitems("DestinationNumber");
CREATE INDEX sentitems_sender ON sentitems("SenderID");
--
-- Dumping data for table "sentitems"
--
-- --------------------------------------------------------
--
-- Create trigger for table "sentitems"
--
CREATE TRIGGER update_timestamp BEFORE UPDATE ON sentitems FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
```

NOTE:

You can find the script in docs/sql/pgsql.sql as well.

## UPGRADING TABLES
The easiest way to upgrade database structure is to backup old one and start with creating new one based on example above.

For upgrading existing database, you can use changes described in smsd-tables-history and then manually update Version field in gammu table.

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-run

title: gammu-smsd-run(7)

text:
# gammu-smsd-run(7)

## NAME
gammu-smsd-run - documentation for RunOnReceive directive

## DESCRIPTION
Gammu SMSD can be configured by RunOnReceive directive (see gammu-smsdrc for details) to run defined program after receiving every message. It can receive single message or more messages, which are parts of one multipart message.

This parameter is executed through shell, so you might need to escape some special characters and you can include any number of parameters. Additionally parameters with identifiers of received messages are appended to the command line. The identifiers depend on used service backend, typically it is ID of inserted row for database backends or file name for file based backends.

Gammu SMSD waits for the script to terminate. If you make some time consuming there, it will make SMSD not receive new messages. However to limit breakage from this situation, the waiting time is limited to two minutes. After this time SMSD will continue in normal operation and might execute your script again.

NOTE:

All input and output file descriptors are closed when this program is invoked, so you have to ensure to open files on your own.

## ENVIRONMENT
New in version 1.28.0.

Program is executed with environment which contains lot of information about the message. You can use it together with NULL service (see gammu-smsd-null) to implement completely own processing of messages.

### Global variables
SMS_MESSAGES

Number of physical messages received.

DECODED_PARTS

Number of decoded message parts.

PHONE_ID

New in version 1.38.2.

Value of PhoneID. Useful when running multiple instances (see smsd-multi).

### Per message variables
The variables further described as SMS_1_... are generated for each physical message, where 1 is replaced by current number of message.

SMS_1_CLASS

Class of message.

SMS_1_NUMBER

Sender number.

SMS_1_TEXT

Message text. Text is not available for 8-bit binary messages.

SMS_1_REFERENCE

New in version 1.38.5.

Message Reference. If delivery status received, this variable contains TPMR of original message

### Per part variables
The variables further described as DECODED_1_... are generated for each message part, where 1 is replaced by current number of part. Set are only those variables whose content is present in the message.

DECODED_1_TEXT

Decoded long message text.

DECODED_1_MMS_SENDER

Sender of MMS indication message.

DECODED_1_MMS_TITLE

title of MMS indication message.

DECODED_1_MMS_ADDRESS

Address (URL) of MMS from MMS indication message. SEE ALSO:

faq-mms-download

DECODED_1_MMS_SIZE

Size of MMS as specified in MMS indication message.

## EXAMPLES

### Activating RunOnReceive
To activate this feature you need to set RunOnReceive in the gammu-smsdrc.

```
[smsd]
RunOnReceive = /path/to/script.sh
```

### Processing messages from the files backend
Following script (if used as RunOnReceive handler) passes message data to other program. This works only with the gammu-smsd-files.

```
#!/bin/sh
INBOX=/path/to/smsd/inbox
PROGRAM=/bin/cat
for ID in "$@" ; do

    $PROGRAM < $INBOX/$ID
done
```

### Invoking commands based on message text
Following script (if used as RunOnReceive handler) executes given programs based on message text.

```
#!/bin/sh
# Check for sender number
if [ "$SMS_1_NUMBER" != "+420123456789" ] ; then

    exit
fi
# Handle commands
case "$SMS_1_TEXT" in

    "DMS A")

        /usr/bin/dms-a

        ;;

    "DMS B")

        /usr/bin/dms-b

        ;;
esac
```

### Passing message text to program
Following script (if used as RunOnReceive handler) passes message text and sender to external program.

```
#!/bin/sh
PROGRAM=/bin/echo
for i in `seq $SMS_MESSAGES` ; do

    eval "$PROGRAM \"\${SMS_${i}_NUMBER}\" \"\${SMS_${i}_TEXT}\""
done
```

### Passing MMS indication parameters to external program
Following script (if used as RunOnReceive handler) will write information about each received MMS indication to the log file. Just replace echo command with your own program to do custom processing.

```
#!/bin/sh
if [ $DECODED_PARTS -eq 0 ] ; then

    # No decoded parts, nothing to process

    exit
fi
if [ "$DECODED_1_MMS_ADDRESS" ] ; then

    echo "$DECODED_1_MMS_ADDRESS" "$DECODED_1_MMS_SENDER" "$DECODED_1_MMS_TITLE" >> /tmp/smsd-mms.log
fi
```

### Processing message text in Python
Following script (if used as RunOnReceive handler) written in Python will concatenate all text from received message:

```
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
numparts = int(os.environ['DECODED_PARTS'])
text = ''
# Are there any decoded parts?
if numparts == 0:

    text = os.environ['SMS_1_TEXT']
# Get all text parts
else:

    for i in range(1, numparts + 1):

        varname = 'DECODED_%d_TEXT' % i

        if varname in os.environ:

            text = text + os.environ[varname]
# Do something with the text
print('Number %s have sent text: %s' % (os.environ['SMS_1_NUMBER'], text))
```

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>


gammu-smsd-sql

title: gammu-smsd-sql(7)

text:
# gammu-smsd-sql(7)

## NAME
gammu-smsd-sql - gammu-smsd(1) backend using SQL abstraction layer to use any supported database as a message storage

## DESCRIPTION
SQL service stores all its data in database. It can use one of these SQL backends (configuration option Driver in smsd section):

- native_mysql for gammu-smsd-mysql

- native_pgsql for gammu-smsd-pgsql

- odbc for gammu-smsd-odbc

-

drivers supported by DBI for gammu-smsd-dbi, which include:

- sqlite3 - for SQLite 3

- mysql - for MySQL

- pgsql - for PostgeSQL

- freetds - for MS SQL Server or Sybase

## SQL CONNECTION PARAMETERS
Common for all backends:

- User - user connecting to database

- Password - password for connecting to database

- Host - database host or data source name

- Database - database name

- Driver - native_mysql, native_pgsql, odbc or DBI one

- SQL - SQL dialect to use

Specific for DBI:

- DriversPath - path to DBI drivers

- DBDir - sqlite/sqlite3 directory with database

SEE ALSO:

The variables are fully described in gammurc documentation.

## TABLES
New in version 1.37.1.

You can customize name of all tables in the [tables]. The SQL queries will reflect this, so it's enough to change table name in this section.

gammu

Name of the gammu-table table.

inbox

Name of the inbox table.

sentitems

Name of the sentitems table.

outbox

Name of the outbox table.

outbox_multipart

Name of the outbox_multipart table.

phones

Name of the phones table.

You can change any table name using these:

```
[tables]
inbox = special_inbox
```

## SQL QUERIES
Almost all queries are configurable. You can edit them in [sql] section. There are several variables used in SQL queries. We can separate them into three groups:

- phone specific, which can be used in every query, see Phone Specific Parameters

- SMS specific, which can be used in queries which works with SMS messages, see SMS Specific Parameters

- query specific, which are numeric and are specific only for given query (or set of queries), see Configurable queries

### Phone Specific Parameters
%I

IMEI of phone

%S

SIM IMSI

%P

PHONE ID (hostname)

%N

client name (eg. Gammu 1.12.3)

%O

network code

%M

network name

### SMS Specific Parameters
%R

remote number [1]

%C

delivery datetime

%e

delivery status on receiving or status error on sending

%t

message reference

%d

receiving datetime for received sms

%E

encoded text of SMS

%c

SMS coding (ie 8bit or UnicodeNoCompression)

%F

sms centre number

%u

UDH header

%x

class

%T

decoded SMS text

%A

CreatorID of SMS (sending sms)

%V

relative validity

[1]

Sender number for received messages (insert to inbox or delivery notifications), destination otherwise.

## CONFIGURABLE QUERIES
All configurable queries can be set in [sql] section. Sequence of rows in selects are mandatory.

All default queries noted here are noted for MySQL. Actual time and time addition are selected for default queries during initialization.

delete_phone

Deletes phone from database. Default value:

```
DELETE FROM phones WHERE IMEI = %I
```

insert_phone

Inserts phone to database. Default value:

```
INSERT INTO phones (IMEI, ID, Send, Receive, InsertIntoDB, TimeOut, Client, Battery, Signal)
VALUES (%I, %P, %1, %2, NOW(), (NOW() + INTERVAL 10 SECOND) + 0, %N, -1, -1)
```

Query specific parameters:

%1

enable send (yes or no) - configuration option Send

%2

enable receive (yes or no) - configuration option Receive

save_inbox_sms_select

Select message for update delivery status. Default value:

```
SELECT ID, Status, SendingDateTime, DeliveryDateTime, SMSCNumber FROM sentitems
WHERE DeliveryDateTime IS NULL AND SenderID = %P AND TPMR = %t AND DestinationNumber = %R
```

save_inbox_sms_update_delivered

Update message delivery status if message was delivered. Default value:

```
UPDATE sentitems SET DeliveryDateTime = %C, Status = %1, StatusError = %e WHERE ID = %2 AND TPMR = %t
```

Query specific parameters:

%1

delivery status returned by GSM network

%2

ID of message

save_inbox_sms_update

Update message if there is an delivery error. Default value:

```
UPDATE sentitems SET Status = %1, StatusError = %e WHERE ID = %2 AND TPMR = %t
```

Query specific parameters:

%1

delivery status returned by GSM network

%2

ID of message

save_inbox_sms_insert

Insert received message. Default value:

```
INSERT INTO inbox (ReceivingDateTime, Text, SenderNumber, Coding, SMSCNumber, UDH,
Class, TextDecoded, RecipientID) VALUES (%d, %E, %R, %c, %F, %u, %x, %T, %P)
```

update_received

Update statistics after receiving message. Default value:

```
UPDATE phones SET Received = Received + 1 WHERE IMEI = %I
```

refresh_send_status

Update messages in outbox. Default value:

```
UPDATE outbox SET SendingTimeOut = (NOW() + INTERVAL 60 SECOND) + 0
WHERE ID = %1 AND (SendingTimeOut < NOW() OR SendingTimeOut IS NULL)
```

The default query calculates sending timeout based on LoopSleep value.

Query specific parameters:

%1

ID of message

find_outbox_sms_id

Find sms messages for sending. Default value:

```
SELECT ID, InsertIntoDB, SendingDateTime, SenderID FROM outbox
WHERE SendingDateTime < NOW() AND SendingTimeOut <  NOW() AND
SendBefore >= CURTIME() AND SendAfter <= CURTIME() AND
( SenderID is NULL OR SenderID = '' OR SenderID = %P ) ORDER BY InsertIntoDB ASC LIMIT %1
```

Query specific parameters:

%1

limit of sms messages sended in one walk in loop

find_outbox_body

Select body of message. Default value:

```
SELECT Text, Coding, UDH, Class, TextDecoded, ID, DestinationNumber, MultiPart,
RelativeValidity, DeliveryReport, CreatorID FROM outbox WHERE ID=%1
```

Query specific parameters:

%1

ID of message

find_outbox_multipart

Select remaining parts of sms message. Default value:

```
SELECT Text, Coding, UDH, Class, TextDecoded, ID, SequencePosition
FROM outbox_multipart WHERE ID=%1 AND SequencePosition=%2
```

Query specific parameters:

%1

ID of message

%2

Number of multipart message

delete_outbox

Remove messages from outbox after threir successful send. Default value:

```
DELETE FROM outbox WHERE ID=%1
```

Query specific parameters:

%1

ID of message

delete_outbox_multipart

Remove messages from outbox_multipart after threir successful send. Default value:

```
DELETE FROM outbox_multipart WHERE ID=%1
```

Query specific parameters:

%1

ID of message

create_outbox

Create message (insert to outbox). Default value:

```
INSERT INTO outbox (CreatorID, SenderID, DeliveryReport, MultiPart,
InsertIntoDB, Text, DestinationNumber, RelativeValidity, Coding, UDH, Class,
TextDecoded) VALUES (%1, %P, %2, %3, NOW(), %E, %R, %V, %c, %u, %x, %T)
```

Query specific parameters:

%1

creator of message

%2

delivery status report - yes/default

%3

multipart - FALSE/TRUE

%4

Part (part number)

%5

ID of message

create_outbox_multipart

Create message remaining parts. Default value:

```
INSERT INTO outbox_multipart (SequencePosition, Text, Coding, UDH, Class,
TextDecoded, ID) VALUES (%4, %E, %c, %u, %x, %T, %5)
```

Query specific parameters:

%1

creator of message

%2

delivery status report - yes/default

%3

multipart - FALSE/TRUE

%4

Part (part number)

%5

ID of message

add_sent_info

Insert to sentitems. Default value:

```
INSERT INTO sentitems (CreatorID,ID,SequencePosition,Status,SendingDateTime,
SMSCNumber, TPMR, SenderID,Text,DestinationNumber,Coding,UDH,Class,TextDecoded,
InsertIntoDB,RelativeValidity)
VALUES (%A, %1, %2, %3, NOW(), %F, %4, %P, %E, %R, %c, %u, %x, %T, %5, %V)
```

Query specific parameters:

%1

ID of sms message

%2

part number (for multipart sms)

%3

message state (SendingError, Error, SendingOK, SendingOKNoReport)

%4

message reference (TPMR)

%5

time when inserted in db

update_sent

Update sent statistics after sending message. Default value:

```
UPDATE phones SET Sent= Sent + 1 WHERE IMEI = %I
```

refresh_phone_status

Update phone status (battery, signal). Default value:

```
UPDATE phones SET TimeOut= (NOW() + INTERVAL 10 SECOND) + 0,
Battery = %1, Signal = %2 WHERE IMEI = %I
```

Query specific parameters:

%1

battery percent

%2

signal percent

update_retries

Update number of retries for outbox message. The interval can be configured by RetryTimeout.

```
UPDATE outbox SET SendngTimeOut = (NOW() + INTERVAL 600 SECOND) + 0,
Retries = %2 WHERE ID = %1
```

Query specific parameters:

%1

message ID

%2

number of retries

## AUTHOR
Michal Čihař <michal@cihar.com>

## COPYRIGHT
2009-2015, Michal Čihař <michal@cihar.com>