Welcome to Jetson AGX Thor repository
14.Managing custom services
Custom Service Management
This course uses creating a JupyterLab service that starts automatically on boot as an example. This is for reference only regarding service management procedures. Actual factory images already have the JupyterLab service configured to start automatically on boot.
1. Creating a Service File
Create a file named jupyterlab.service in your user directory.
xxxxxxxxxxtouch jupyterlab.servicevim jupyterlab.service
Add the following content: User represents the username and needs to be modified according to your actual username; ExecStart represents the command to be executed and needs to be modified according to your actual command.
System service file:
xxxxxxxxxx[Unit]Description=jupyterlab serviceAfter=network.target[Service]Type=simpleExecStart=/usr/local/bin/jupyter-labconfig=/home/jetson/.jupyter/jupyter_lab_config.py --no-browserUser=jetsonGroup=jetsonWorkingDirectory=/home/jetson/Restart=alwaysRestartSec=10[Install]WantedBy=multi-user.target
Then press Esc to exit editing, type :wq to save and exit the file.
2. Update Services
Copy the newly created jupyterlab.service service file to the /etc/systemd/system/ path.
xxxxxxxxxxsudo cp jupyterlab.service /etc/systemd/system/
Update system service
xxxxxxxxxxsudo systemctl daemon-reload
3. Managing services
Check service status
xxxxxxxxxxsudo systemctl status jupyterlab.service
Start service
xxxxxxxxxxsudo systemctl start jupyterlab.service
Restart service
xxxxxxxxxxsudo systemctl restart jupyterlab.service
Set service to start automatically on boot
xxxxxxxxxxsudo systemctl enable jupyterlab.service
Stop service
xxxxxxxxxxsudo systemctl stop jupyterlab.service
Disable service from starting on boot
xxxxxxxxxxsudo systemctl disable jupyterlab.service