Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • edi/eins-apps
1 result
Show changes
Commits on Source (2)
...@@ -2,3 +2,12 @@ ...@@ -2,3 +2,12 @@
Runlevel=1 Runlevel=1
CmdStart=pulseaudio start CmdStart=pulseaudio start
CmdStop=pulseaudio stop CmdStop=pulseaudio stop
[message]
Runlevel=2
CmdStart=
say Subraum startet
sob subraum_startup
CmdStop=
say Subraum faehrt runter
sob subraum_shutdown
...@@ -18,8 +18,8 @@ for section in config.sections(): ...@@ -18,8 +18,8 @@ for section in config.sections():
command = config[section] command = config[section]
try: try:
runlevel = int(command['Runlevel']) runlevel = int(command['Runlevel'])
start = command['CmdStart'] start = command['CmdStart'].splitlines()
stop = command['CmdStop'] stop = command['CmdStop'].splitlines()
if runlevel not in runlevels: if runlevel not in runlevels:
runlevels[runlevel] = list() runlevels[runlevel] = list()
runlevels[runlevel].append({ 'name': section, 'start': start, 'stop': stop }) runlevels[runlevel].append({ 'name': section, 'start': start, 'stop': stop })
...@@ -31,10 +31,13 @@ old_level = 0 ...@@ -31,10 +31,13 @@ old_level = 0
eins = Eins() eins = Eins()
def emit_cmd(command_string): def emit_cmds(command_strings):
print(f"Emitting cmd: {command_string}") for command in command_strings:
argv = shlex.split(command_string) if command == "":
eins.emit_cmd(argv[0], *argv[1:]) continue
print(f"Emitting cmd: {command}")
argv = shlex.split(command)
eins.emit_cmd(argv[0], *argv[1:])
# This is a silent command, subinitd already describes the same command # This is a silent command, subinitd already describes the same command
@eins.simple_cmd() @eins.simple_cmd()
...@@ -48,13 +51,13 @@ def telinit2(new_level): ...@@ -48,13 +51,13 @@ def telinit2(new_level):
if i in runlevels: if i in runlevels:
for command in runlevels[i]: for command in runlevels[i]:
print(f"Starting {command['name']}") print(f"Starting {command['name']}")
emit_cmd(command['start']) emit_cmds(command['start'])
else: else:
for i in reversed(range(new_level+1, old_level+1)): for i in reversed(range(new_level+1, old_level+1)):
if i in runlevels: if i in runlevels:
for command in runlevels[i]: for command in runlevels[i]:
print(f"Stopping {command['name']}") print(f"Stopping {command['name']}")
emit_cmd(command['stop']) emit_cmds(command['stop'])
old_level = new_level old_level = new_level
......