This is my rstudio-server.service
[Service]
Type=simple
Environment="PATH=/home/rstudio-server/anaconda3/bin:/home/rstudio-server/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin"
# 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
It will fail in systemctl start rstudio-server.service
but it will start with sudo /home/rstudio-server/scripts/start_rstudio_server_with_conda.sh
which is basically to setup the ENviroment in service file.
- /home/rstudio-server/scripts/start_rstudio_server_with_conda.sh is as follows
#!/bin/bash
# Activate the Conda environment
source /home/rstudio-server/anaconda3/bin/activate RStudio
# make sure cifs drive are mounted
# echo 'b23258585' | sudo -S mount --all
# Start RStudio Server
exec /opt/rstudio-2024-12-20/bin/rserver