Skip to content

Commit

Permalink
Merge pull request #1527 from cvisionai/dev/startup_script
Browse files Browse the repository at this point in the history
Add scripts to help with node reboot.
  • Loading branch information
bctcvai authored Dec 18, 2023
2 parents 9f8c05b + b7823ce commit f9354c7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/make_systemd_unit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/python3
import os
import os

# $> python3 scripts/make_systemd_unit.py > tatorRestart.service
# $> sudo mv tatorRestart.service /etc/systemd/system/
# $> sudo systemctl daemon-reload
# $> sudo systemctl enable tatorRestart.service
# $> sudo systemctl start tatorRestart.service
# $> verify on reboot that tator is running!

template="""
[Unit]
Description=Restart docker compose tator install
Requires=docker.service
[Service]
Type=oneshot
ExecStart=/bin/bash {path}/scripts/restart_docker.sh {path} {user}
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
"""

if __name__=="__main__":
username = os.getlogin()
path = os.getcwd()
print(template.format(path=path,user=username))

3 changes: 3 additions & 0 deletions scripts/restart_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

runuser -u ${2} -- make -C ${1} clean tator

0 comments on commit f9354c7

Please sign in to comment.