§2024-12-20

 (RStudio) rstudio-server@Jetson:~/RStudio/build/rstudio/build$ echo 'b23258585' | sudo -S  make install > make_install-2024-12-20.log 2>&1 &

(RStudio) rstudio-server@Jetson:/opt$ sudo chown -R rstudio-server:rstudio-server /opt/rstudio-2024-12-20/
(RStudio) rstudio-server@Jetson:/opt$ ls -l
total 32
drwx--x--x  4 root           root           4096 十二 13 10:33 containerd
drwxr-xr-x 17 root           root           4096 十二 13 11:02 nvidia
drwxr-xr-x  3 root           root           4096 十二 11 07:31 ota_package
drwxr-xr-x  9 rstudio-server rstudio-server 4096 十二 19 16:35 rstudio
drwxr-xr-x  2 rstudio-server rstudio-server 4096 十二 20 15:54 RStudio
drwxr-xr-x  9 rstudio-server rstudio-server 4096 十二 20 17:50 rstudio-2024-12-20
drwxr-xr-x  3 root           root           4096 十二 19 14:00 rstudio-tools
drwxr-xr-x  2 root           root           4096 十二 17 07:12 sda3

$ cat start_rstudio_server_with_conda.sh 
#!/bin/bash

# Activate the Conda environment
source /home/rstudio-server/anaconda3/bin/activate RStudio

# Start RStudio Server
exec /opt/rstudio-2024-12-20/bin/rserver
(RStudio) rstudio-server@Jetson:/etc/systemd/system$ cat rstudio-server.service 
[Unit]
Description=RStudio Server
# After=network.target
After=create-rstudio-server-dir.service
Requires=create-rstudio-server-dir.service


[Service]
Type=simple
# ExecStart=/opt/rstudio/bin/rstudio-server start
# ExecStart=/opt/rstudio-2024-12-20/bin/rserver
ExecStart=/home/rstudio-server/scripts/start_rstudio_server_with_conda.sh

User=rstudio-server
Group=rstudio-server
WorkingDirectory=/opt/rstudio-2024-12-20
Restart=always
LimitNOFILE=10000

[Install]
WantedBy=multi-user.target
(RStudio) rstudio-server@Jetson:/etc/systemd/system$ cat create-rstudio-server-dir.service 
[Unit]
Description=Ensure /var/run/rstudio-server directory exists
Before=rstudio-server.service

[Service]
Type=oneshot
ExecStart=/bin/mkdir -p /var/run/rstudio-server
ExecStartPost=/bin/chown rstudio-server:rstudio-server /var/run/rstudio-server
ExecStartPost=/bin/chmod 755 /var/run/rstudio-server
RemainAfterExit=true

[Install]
WantedBy=multi-user.target