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 <https://doc.qt.io/qt-5/deployment-android.html> 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 <https://doc.qt.io/qt-5/deployment-android.html> 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) <#manual: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).

branch: sisyphus


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/


fswatch

package: fswatch

title: fswatch(7)

text:
# fswatch(7)

## NAME
fswatch — Ask for notification when the contents of the specified files or directory hierarchies are modified.

This man page is kept for reference but it is not to be considered an authoritative or complete source of information. Please, consult the official Info documentation shipped with fswatch.

## SYNOPSIS
fswatch (option)* path+

## DESCRIPTION
The fswatch command receives notifications when the contents of the specified files or directories are modified. fswatch implements six kind of monitors:

-

A monitor based on the File System Events API of Apple macOS.

-

A monitor based on kqueue, an event notification interface introduces in FreeBSD 4.1 and supported on most *BSD systems (including macOS).

-

A monitor based on the File Events Notification API of the Solaris kernel and its derivatives.

-

A monitor based on inotify, a Linux kernel subsystem that reports file system changes to applications.

-

A monitor based on the ReadDirectoryChangesW Microsoft Windows API.

-

A monitor which periodically stats the file system, saves file modification times in memory and manually calculates changes.

fswatch writes a record for each event it receives containing:

-

The timestamp when the event was received (optionally).

-

The path affected by the current event.

-

A space-separated list of event types (see EVENT TYPES ).

fswatch enters an infinite loop and never returns. When it receives a SIGABRT, SIGINT or SIGTERM signal, fswatch closes the notification streams and exits gracefully returning 0 to the calling process.

The following options are available:

-0, --print0

Use the ASCII NUL character (\0) as line separator. Since file names can potentially contain any character but NUL, this option assures that the output of fswatch can be safely parsed using NUL as delimiter, such as using xargs -0 and the shell builtin read -d ''.

-1, --one-event

Exit fswatch after the first set of events is received.

--batch-marker marker

Print a marker at the end of every batch. An optional marker marker can be specified to override its default value `NoOp'.

--event name

Filter event with the specified name. This option can be used multiple times, one for each event name that must be included in the output.

-e, --exclude regexp

Exclude paths matching regexp. Multiple exclude filters can be specified using this option multiple times. See FILTERING PATHS for further information.

-E, --extended

Use extended regular expressions.

-f, --format-time format

Print the event time using the specified format. Supported formats are specified by strftime(3).

-h, --help

Show the help message.

-i, --include regexp

Include paths matching regexp. Multiple include filters can be specified using this option multiple times. See FILTERING PATHS for further information.

-I, --insensitive

Use case insensitive regular expressions.

-l, --latency latency

Set the latency in seconds. The latency is a double value greater than 0.1. Smaller values are currently not allowed in order not to compromise the performance of the system. The default latency is 1 second.

-L, --follow-links

Follow symbolic links.

-M, --list-monitors

List the available monitors.

-m, --monitor name

Uses the monitor specified by name. The list of currently available monitors can be obtained using the -h option.

--no-defer

Sets the kFSEventStreamCreateFlagNoDefer flag on macOS FSEvents monitor, which makes the monitor more responsive. This flag is more appropriate for sessions, while the default behaviour is more appropriate for background, daemon or batch processing apps.

-n, --numeric

Print the numeric value of the event flag, instead of the array of symbolic names. The numeric value of the event flags are system-specific and may vary across different versions of macOS. As a consequence, the use of numeric values is discouraged.

-o, --one-per-batch

Print a single message with the number of change events.

-r, --recursive

Watch subdirectories recursively. This option may not be supported on all systems.

-t, --timestamp

Print the event timestamp.

-u, --utf-time

Print the event time in UTC format. When this option is not specified, the time is printed using the system local time, as defined by localtime (3).

-v, --verbose

Print verbose output.

--version

Print the version of fswatch and exits.

-x, --event-flags

Prints the event flags.

--event-flag-separator separator

Print event flags using the specified separator.

## MONITORS
fswatch acts as a front-end to system-specific monitors. Currently, the available monitors are:

-

The FSEvents monitor, a monitor based on the File System Events API of Apple macOS.

-

The kqueue monitor, a monitor based on kqueue, an event notification interface introduced in FreeBSD 4.1 and supported on most *BSD systems (including macOS).

-

The inotify monitor, a Linux kernel subsystem that reports file system changes to applications.

-

The poll monitor, a monitor which periodically stats the file system, saves file modification times in memory and manually calculates file system changes, which can work on any operating system where stat(2) can be used.

Each monitor has its own strengths, weakness and peculiarities. Although fswatch strives to provide a uniform experience no matter which monitor is used, it is still important for users to know which monitor they are using and to be aware of existing bugs, limitations, corner cases or pathological behaviour.

### The FSEvents Monitor
The FSEvents monitor, available only on Apple macOS, has no known limitations and scales very well with the number of files being observed. In fact, I observed no performance degradation when testing fswatch observing changes on a filesystem of 500 GB over long periods of time. On macOS, this is the default monitor.

### The kqueue Monitor
The kqueue monitor, available on any *BSD system featuring kqueue, requires a file descriptor to be opened for every file being watched. As a result, this monitor scales badly with the number of files being observed and may begin to misbehave as soon as the fswatch process runs out of file descriptors. In this case, fswatch dumps one error on standard error for every file that cannot be opened. Beware that on some systems the maximum number of file descriptors that can be opened by a process is set to a very low value (values as low as 256 are not uncommon), even if the operating system may allow a much larger value.

If you are running out of file descriptors when using this monitor and you cannot reduce the number of observed items, either:

-

Consider raising the number of maximum open file descriptors (check your OS documentation).

-

Consider using another monitor.

### The inotify Monitor
The inotify monitor, available on Linux since kernel 2.6.13, may suffer a queue overflow if events are generated faster than they are read from the queue. In any case, the application is guaranteed to receive an overflow notification which can be handled to gracefully recover. fswatch currently throws an exception if a queue overflow occurs. Future versions will handle the overflow by emitting proper notifications. However, the odds of observing a queue overflow on a default configured mainstream GNU/Linux distribution is very low.

The inotify API sends events for the direct child elements of a watched directory and it scales pretty well with the number of watched items. For this reason, depending on the number of files to watch, it may sometimes be preferable to watch a common parent directory and filter received events rather than adding a huge number of file watches.

### The Poll Monitor
The poll monitor was added as a fallback mechanisms in the cases where no other monitor could be used, including:

-

Operating system without any sort of file events API.

-

Situations where the limitations of the available monitors cannot be overcome (i.e.: observing a number of files greater than the available file descriptors on a system using the kqueue monitor).

The poll monitor, available on any platform, only relies on available CPU and memory to perform its task (besides the stat(2) function). The performance of this monitor degrades linearly with the number of files being watched. The authors' experience indicates that fswatch requires approximately 150 MB or RAM memory to observe a hierarchy of 500.000 files with a minimum path length of 32 characters. A common bottleneck of the poll monitor is disk access, since stat()-ing a great number of files may take a huge amount of time. In this case, the latency should be set to a sufficiently large value in order to reduce the performance degradation that may result from frequent disk access.

### How to Choose a Monitor
fswatch already chooses the "best" monitor for your platform if you do not specify any. However, a specific monitor may be better suited to specific use cases. Please, read the MONITORS section to get a description of all the available monitors and their limitations.

Usage recommendations are as follows:

-

On macOS, use only the FSEvents monitor (which is the default behaviour).

-

On Linux, use the inotify monitor (which is the default behaviour).

-

If the number of files to observe is sufficiently small, use the kqueue monitor. Beware that on some systems the maximum number of file descriptors that can be opened by a process is set to a very low value (values as low as 256 are not uncommon), even if the operating system may allow a much larger value. In this case, check your OS documentation to raise this limit on either a per process or a system-wide basis.

-

If feasible, watch directories instead of watching files. Properly crafting the receiving side of the events to deal with directories may sensibly reduce the monitor resource consumption.

-

If none of the above applies, use the poll monitor. The authors' experience indicates that fswatch requires approximately 150 MB or RAM memory to observe a hierarchy of 500.000 files with a minimum path length of 32 characters. A common bottleneck of the poll monitor is disk access, since stat()-ing a great number of files may take a huge amount of time. In this case, the latency should be set to a sufficiently large value in order to reduce the performance degradation that may result from frequent disk access.

## FILTERING PATHS
Received events can be filtered by path using regular expressions. Regular expressions can be used to include or exclude matching paths. The user can specify multiple filter expression in any order and the first matching expression wins.

Other options govern how regular expressions are interpreted:

-

Regular expressions can be extended if option -E is specified.

-

Regular expressions can be case insensitive if option -I is specified.

## EVENT TYPES
Event flags identify the kind of change a file system object has undergone. Many of them directly map to common file system operations (such as creation, deletion, update, etc.), others are less common (such as attribute modification), and others are monitor and platform specific.

Currently, fswatch maps monitor-specific event flags to 'global' event flags acting as a sort of 'greatest common denominator' of all the available monitor flags. The following global event flags are available::

NoOp

Idle event, optionally issued when no changes were detected.

PlatformSpecific

This event maps a platform-specific event that has no corresponding flag.

Created

The object has been created.

Updated

The object has been updated. The kind of update is monitor-dependent.

Removed

The object has been removed.

Renamed

The object has been renamed.

OwnerModified

The object’s owner has changed.

AttributeModified

An object’s attribute has changed.

MovedFrom

The object has moved from this location to a new location of the same file system.

MovedTo

The object has moved from another location in the same file system into this location.

IsFile

The object is a regular file.

IsDir

The object is a directory.

IsSymLink

The object is a symbolic link.

Link

The object link count has changed.

Overflow

The monitor has overflowed.

## EXAMPLES

### Basic Usage
fswatch syntax is the following:

$ fswatch [options] [paths] ...

fswatch will then output change events to standard output. By default, only the affected file name is printed. However, many options are available to format the event record, including:

-

The possibility of adding the event timestamp.

-

The possibility of adding the event mask in both textual and numerical form.

The following command listens for changes in the current directory and events are delivered every 5 seconds:

$ fswatch -l 5 .

The following command listens for changes in the current user home directory and /var/log:

$ fswatch ~ /var/log

### Piping fswatch Output to Another Process
Very often you wish to not only receive an event, but react to it. The simplest way to do it is piping fswatch output to another process. Since in Unix and Unix-like file system file names may potentially contain any character but NUL (\0) and the path separator (/), fswatch has a specific mode of operation when its output must be piped to another process. When the [-0] option is used, fswatch will use the NUL character as record separator, thus allowing any other character to appear in a path. This is important because many commands and shell builtins (such as read) split words and lines by default using the characters in $IFS, which by default contains characters which may be present (although rarely) in a file name, resulting in a wrong event path being received and processed.

Probably the simplest way to pipe fswatch to another program in order to respond to an event is using xargs:

$ fswatch -0 [opts] [paths] | xargs -0 -n 1 -I {} [command]

-

fswatch -0 will split records using the NUL character.

-

xargs -0 will split records using the NUL character. This is required to correctly match impedance with fswatch.

-

xargs -n 1 will invoke command every record. If you want to do it every x records, then use xargs -n x.

-

xargs -I {} will substitute occurrences of {} in command with the parsed argument. If the command you are running does not need the event path name, just delete this option. If you prefer using another replacement string, substitute {} with yours.

### Bubbling Events
An often requested feature is being able to receive a single event "per batch", instead of receiving multiple events. This use case is implemented by the [-o, --one-per-batch] option which tells fswatch to dump a record containing the number of received events, without any other detail:

$ fswatch -or /path/to/watch

1

10

[...]

This is useful if, for example, you want to respond to change events in a way which is (or can easily be) path-independent (because you are not receiving any event detail) and you prefer to "bubble" events together to reduce the overhead of the command being executed. A typical case is a directory synchronisation job whenever some files change.

### Receiving a Single Event
Another requested feature is the possibility of receiving a single event and exit. This is most useful when existing scripts processing events include the restart logic of fswatch This use case is implemented by the [-1, --one-event] option:

$ fswatch -1 /path/to/watch

/path/to/watch

## Compatibility With fswatch 0.x
The previous major version of fswatch (v. 0.x) allowed users to run a command whenever a set of changes was detected with the following syntax:

$ fswatch path program

Starting with fswatch v. 1.x this behaviour is no longer supported. The rationale behind this decision includes:

-

The old version only allows watching one path.

-

The command to execute was passed as last argument, alongside the path to watch, making it difficult to extend the program functionality to add multiple path support

-

The old version forks and executes /bin/bash, which is neither portable, nor guaranteed to succeed, nor desirable by users of other shells.

-

No information about the change events is passed to the forked process.

To solve the aforementioned issues and keep fswatch consistent with common UNIX practices, the behaviour has changed and fswatch now prints event records to the standard output that users can process further by piping the output of fswatch to other programs.

To fully support the old use, the [-o, --one-per-batch] option was added in v. 1.3.3. When specified, fswatch will only dump 1 event to standard output which can be used to trigger another program:

$ fswatch -o path | xargs -n1 program

In this case, program will receive the number of change events as first argument. If no argument should be passed to program, then the following command could be used:

$ fswatch -o path | xargs -n1 -I{} program

## EXIT STATUS
fswatch may exit with one of the following exit statuses:

FSW_OK 0

FSW_ERR_UNKNOWN_ERROR (1 << 0)

FSW_ERR_SESSION_UNKNOWN (1 << 1)

FSW_ERR_MONITOR_ALREADY_EXISTS (1 << 2)

FSW_ERR_MEMORY (1 << 3)

FSW_ERR_UNKNOWN_MONITOR_TYPE (1 << 4)

FSW_ERR_CALLBACK_NOT_SET (1 << 5)

FSW_ERR_PATHS_NOT_SET (1 << 6)

FSW_ERR_UNKNOWN_MONITOR (1 << 7)

FSW_ERR_MISSING_CONTEXT (1 << 8)

FSW_ERR_INVALID_PATH (1 << 9)

FSW_ERR_INVALID_CALLBACK (1 << 10)

FSW_ERR_INVALID_LATENCY (1 << 11)

FSW_ERR_INVALID_REGEX (1 << 12)

FSW_ERR_MONITOR_ALREADY_RUNNING (1 << 13)

FSW_ERR_STALE_MONITOR_THREAD (1 << 14)

FSW_ERR_THREAD_FAULT (1 << 15)

FSW_ERR_UNSUPPORTED_OPERATION (1 << 16)

FSW_ERR_UNKNOWN_VALUE (1 << 17)

## DIAGNOSTICS
fswatch exits 0 on success, and >0 if an error occurs.

## COMPATIBILITY
fswatch can be built on any system supporting at least one of the available monitors.

## BUGS
See https://github.com/emcrisostomo/fswatch/issues for open issues or to create a new one.

Bugs can also be submitted to enrico.m.crisostomo@gmail.com.


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>