mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
add shutil to autostart cmdline -> no need to enter pwd several times
This commit is contained in:
parent
e044545a5b
commit
0ec02447d5
1 changed files with 4 additions and 4 deletions
|
@ -157,9 +157,9 @@ class CraftBeerPiCli():
|
||||||
destfile = os.path.join("/etc/systemd/system")
|
destfile = os.path.join("/etc/systemd/system")
|
||||||
shutil.os.system('sudo cp "{}" "{}"'.format(srcfile,destfile))
|
shutil.os.system('sudo cp "{}" "{}"'.format(srcfile,destfile))
|
||||||
print("Copied craftbeerpi.service to /etc/systemd/system")
|
print("Copied craftbeerpi.service to /etc/systemd/system")
|
||||||
os.system('systemctl enable craftbeerpi.service')
|
shutil.os.system('sudo systemctl enable craftbeerpi.service')
|
||||||
print('Enabled craftbeerpi service')
|
print('Enabled craftbeerpi service')
|
||||||
os.system('systemctl start craftbeerpi.service')
|
shutil.os.system('sudo systemctl start craftbeerpi.service')
|
||||||
print('Started craftbeerpi.service')
|
print('Started craftbeerpi.service')
|
||||||
else:
|
else:
|
||||||
print("craftbeerpi.service is already located in /etc/systemd/system")
|
print("craftbeerpi.service is already located in /etc/systemd/system")
|
||||||
|
@ -172,9 +172,9 @@ class CraftBeerPiCli():
|
||||||
try:
|
try:
|
||||||
status = os.popen('systemctl list-units --type=service --state=running | grep craftbeerpi.service').read()
|
status = os.popen('systemctl list-units --type=service --state=running | grep craftbeerpi.service').read()
|
||||||
if status.find("craftbeerpi.service") != -1:
|
if status.find("craftbeerpi.service") != -1:
|
||||||
os.system('systemctl stop craftbeerpi.service')
|
shutil.os.system('sudo systemctl stop craftbeerpi.service')
|
||||||
print('Stopped craftbeerpi service')
|
print('Stopped craftbeerpi service')
|
||||||
os.system('systemctl disable craftbeerpi.service')
|
shutil.os.system('sudo systemctl disable craftbeerpi.service')
|
||||||
print('Removed craftbeerpi.service as service')
|
print('Removed craftbeerpi.service as service')
|
||||||
else:
|
else:
|
||||||
print('craftbeerpi.service service is not running')
|
print('craftbeerpi.service service is not running')
|
||||||
|
|
Loading…
Reference in a new issue