Unlike Gurobi's Compute Server, Gurobi's Token Server cannot be installed as a service. This means you manually have to tell your operating system to launch the token server. There are a few different ways to accomplish this:
The easiest way to achieve this is by creating or extending the file /etc/rc.local, which is executed when the system has booted. This file should look something like this:
#!/bin/bash
/opt/gurobi1103/linux64/bin/grb_ts
exit 0
In addition, you need to change the permissions of the rc.local file such that it can be executed by running
sudo chmod +x /etc/rc.local
You can also use cron to start the token server process after every reboot. As user root, you need to open the cron configuration using
crontab -e
Then, you can enter the command to start grb_ts after a restart:
@reboot /opt/gurobi1103/linux64/bin/grb_ts
To check whether the new cron command has been registered, you can run
crontab -l
systemd can be configured to run the token server as a "simple" service type. To set this up, create a service file at /etc/systemd/system/grb_ts.service with the following contents:
[Unit]
Description=Gurobi Token Server
After=network.target
[Service]
Type=simple
ExecStart=/opt/gurobi1103/linux64/bin/grb_ts -n
Restart=on-failure
[Install]
WantedBy=multi-user.target
The important points to note here are that the service type is set to simple, and that grb_ts is run with the -n switch so that it does not fork when started.
To inform systemd of this new service file, start the service, and set it to start automatically when the system boots, run the following:
sudo systemctl daemon-reload
sudo systemctl start grb_ts
sudo systemctl enable grb_ts
The status of the service can then be checked using:
sudo systemctl status grb_ts
Please also note that in this case the token server is run as the root user, so the license file should be installed at the default location /opt/gurobi/gurobi.lic, not in the account of a particular user.
Comments
0 comments
Article is closed for comments.