uci-utils-systemd/example/index.js

29 lines
683 B
JavaScript

import systemd from '../'
const SERVICE = 'uci.service'
const PATH = 'uci.path'
const DEST = '/opt/light'
const NAME = 'name-device-DE4Y'
;
(async () => {
let settings= await systemd.read('./example/'+SERVICE)
.catch(err => {throw err})
settings.Service.WorkingDirectory=`${DEST}/${NAME}`
console.log(systemd.stringify(settings))
systemd.write(`./example/${NAME}.service`,settings)
settings= await systemd.read('./example/'+PATH)
.catch(err => {throw err})
settings.Path.PathModified=`${DEST}/${NAME}`
console.log(systemd.stringify(settings))
systemd.write(`./example/${NAME}.path`,settings)
})().catch((err) => {console.log('fatal error', err)})