Hello forum,

I thought to extend the battery life of my thinkpad device so I found tpacpi, and have tried to convert the service file from system.d version. However, I cannot get it to parse using 66-enable. Grade my mistake please? Here is the 66-service file content:
 
[main]
@ type = longrun
@ description = "sets battery thresholds"
@ user = ( root )
@ options = ( log )


[start]
@ build = auto
@ execute = ( exec /usr/bin/tpacpi-bat -s ST $BATTERY $START_THRESHOLD )

[stop]
@ build = auto
@ execute = ( exec /usr/bin/tpacpi-bat -s ST $BATTERY $STOP_THRESHOLD )

[environment]
conf_file=!/etc/conf.d/tpacpi

Please provide the log output with -v4 when you get an issue with a 66 command.Anyway, assuming you use the v0.5.0.1 66 version, it miss you the field @ version and the option env,so:(note from v0.4.0.0 the field @ build is no longer mandatory, if not set, auto is pick by default)

[main]
@ type = longrun
@ version = 0.0.1
@ description = "sets battery thresholds"
@ user = ( root )
@ options = ( log env )

[start]
@ execute = ( exec /usr/bin/tpacpi-bat -s ST $BATTERY $START_THRESHOLD )

[stop]
@ execute = ( exec /usr/bin/tpacpi-bat -s ST $BATTERY $START_THRESHOLD )

[environment]
conf_file=!/etc/conf.d/tpacpi
note: the exec command is useless here you can remove it if you want.
Thank you for the tips, eric, I do use 66-tools version 0.6.0.1-1 and adjusted the frontend service file contents.

Here is the v4 result of the failed parse:
# 66-enable -v4 -t tbat tpacpi 
66-enable(src/lib66/parser_enabled.c: parse_service_before: 40): tracing: start parse process of service: /usr/lib/66/service/tpacpi
66-enable(src/lib66/parser_enabled.c: parse_service_before: 80): tracing: read service file of: /usr/lib/66/service/tpacpi
66-enable(src/lib66/parser_utils.c: parse_err: 1100): warning: invalid value for key: @ version: in section: main
66-enable(src/lib66/parser.c: parser: 70): warning: unable to keep information of service file: tpacpi
66-enable(src/lib66/ssexec_enable.c: start_parser: 76): fatal: unable to parse service file: /usr/lib/66/service/tpacpi: or its dependencies
The @ version I put is 3.1, seems must there be a 0 before it so it reads 0.3.1. Then it parsed successfully:
# 66-enable -v4 -t tbat tpacpi 
66-enable(src/lib66/parser_enabled.c: parse_service_before: 40): tracing: start parse process of service: /usr/lib/66/service/tpacpi
66-enable(src/lib66/parser_enabled.c: parse_service_before: 80): tracing: read service file of: /usr/lib/66/service/tpacpi
66-enable(src/lib66/parser_enabled.c: parse_service_deps: 235): tracing: /usr/lib/66/service/tpacpi: haven't dependencies
66-enable(src/lib66/parser_enabled.c: parse_add_service: 358): tracing: add service: /usr/lib/66/service/tpacpi
66-enable(src/lib66/parser_write.c: write_services: 108): tracing: Write service tpacpi ...
66-enable(src/lib66/ssexec_enable.c: start_write: 186): tracing: write resolve file of: tpacpi
66-enable(src/lib66/ssexec_enable.c: start_write: 207): tracing: Service written successfully: tpacpi
s6-rc-compile: tracing: from s6-rc-compile internals: adding identifier s6rc-oneshot-runner of type longrun
s6-rc-compile: tracing: from s6-rc-compile internals: adding identifier s6rc-fdholder of type longrun
s6-rc-compile: info: parsing /tmp/tbat:4jCj3n/db/source/Master
s6-rc-compile: info: Master has type bundle
s6-rc-compile: tracing: from /tmp/tbat:4jCj3n/db/source: adding identifier Master of type bundle
s6-rc-compile: tracing: from Master: adding identifier tpacpi-log of type unknown
s6-rc-compile: tracing: from Master: adding identifier tpacpi of type unknown
s6-rc-compile: info: parsing /tmp/tbat:4jCj3n/db/source/tpacpi
s6-rc-compile: info: tpacpi has type longrun
s6-rc-compile: tracing: from /tmp/tbat:4jCj3n/db/source: adding identifier tpacpi of type longrun
s6-rc-compile: tracing: previously encountered identifier tpacpi now has type longrun
s6-rc-compile: tracing: from tpacpi: adding identifier tpacpi-log of type unknown
s6-rc-compile: tracing: identifier tpacpi-log was already declared with type unknown
s6-rc-compile: info: tpacpi is a producer for tpacpi-log
s6-rc-compile: info: parsing /tmp/tbat:4jCj3n/db/source/tpacpi-log
s6-rc-compile: info: tpacpi-log has type longrun
s6-rc-compile: tracing: from /tmp/tbat:4jCj3n/db/source: adding identifier tpacpi-log of type longrun
s6-rc-compile: tracing: previously encountered identifier tpacpi-log now has type longrun
s6-rc-compile: tracing: from tpacpi-log: adding identifier tpacpi of type unknown
s6-rc-compile: tracing: identifier tpacpi was already declared with type longrun
s6-rc-compile: info: tpacpi-log is a consumer for tpacpi
s6-rc-compile: info: making bundles for pipelines
s6-rc-compile: info: resolving bundle names
s6-rc-compile: info: converting bundle array
s6-rc-compile: info: resolving service names
s6-rc-compile: tracing: tpacpi depends on longrun tpacpi-log (3)
s6-rc-compile: tracing: tpacpi depends on longrun s6rc-fdholder (1)
s6-rc-compile: tracing: tpacpi-log depends on longrun s6rc-fdholder (1)
s6-rc-compile: info: converting service dependency array
s6-rc-compile: info: checking database correctness
s6-rc-compile: info: writing compiled information to /tmp/tbat:4jCj3n/db/tbat
s6-rc-compile: info: writing /tmp/tbat:4jCj3n/db/tbat/n
s6-rc-compile: info: writing /tmp/tbat:4jCj3n/db/tbat/resolve.cdb
s6-rc-compile: info: writing /tmp/tbat:4jCj3n/db/tbat/db
s6-rc-compile: info: writing /tmp/tbat:4jCj3n/db/tbat/servicedirs
66-enable(src/lib66/db_switch_to.c: db_switch_to: 58): tracing: make a backup of db service for: tbat
66-enable(src/lib66/backup_make_new.c: backup_make_new: 84): tracing: create directory: /var/lib/66/system/backup/tbat/db
66-enable(src/lib66/backup_make_new.c: backup_make_new: 88): tracing: copy: /var/lib/66/system/tbat/servicedirs/db to: /var/lib/66/system/backup/tbat/db
66-enable(src/lib66/backup_make_new.c: backup_make_new: 109): tracing: create directory: /var/lib/66/system/backup/tbat/.resolve
66-enable(src/lib66/backup_make_new.c: backup_make_new: 113): tracing: copy: /var/lib/66/system/tbat/servicedirs/.resolve to: /var/lib/66/system/backup/tbat/.resolve
66-enable(src/lib66/db_switch_to.c: db_switch_to: 64): tracing: switch db symlink of tree: tbat to backup
66-enable(src/lib66/ssexec_enable.c: ssexec_enable: 442): info: Enabled successfully: tpacpi
Thank you again for the pointer

Powered by Obarun