Skip to content

Instantly share code, notes, and snippets.

@Sagleft
Created January 18, 2021 12:23
Show Gist options
  • Save Sagleft/e6b62ba9ece7a8fb24454b603ddab0c7 to your computer and use it in GitHub Desktop.
Save Sagleft/e6b62ba9ece7a8fb24454b603ddab0c7 to your computer and use it in GitHub Desktop.

Let's look at how to configure the Utopia client to autorun on Linux, as well as to auto-resume the client if it crashes.

This is useful if you want to place on your machine, for example, an automated bot that will work with Utopia channels.

First, download the client and create a script to update the client. using Centos as an example

cd /home
wget https://update.u.is/downloads/linux/utopia-latest.x86_64.rpm
yum install -y libxkbcommon-x11.x86_64 libGL pulseaudio-libs-glib2
rpm -ivh --replacepkgs utopia-latest.x86_64.rpm

create a script that will be useful later for updating the client:

cd /home
nano update_utopia.sh

content:

rm -rf utopia-latest.x86_64.rpm
wget https://update.u.is/downloads/linux/utopia-latest.x86_64.rpm
rpm -Uvh --replacepkgs utopia-latest.x86_64.rpm

Next, you can set up a connection to the client in headless mode using one of the instructions:

Just notice the difference! We do not use systemctl in this tutorial. Therefore, if you have already created a service to start the client, run:

systemctl stop startopia
systemctl disable startopia

Now let's create a script to autorun the client:

cd /home
nano boot_utopia.sh

content:

#!/bin/sh

ps auxw | grep utopia | grep -v grep > /dev/null
if [ $? != 0 ]
then
  sh /home/utopiahome/start.sh > /dev/null
fi

start.sh is the script you should have done following one of the instructions above.

Then add the task to cron:

EDITOR=nano crontab -e

add line:

* * * * * bash /home/boot_utopia.sh

then reload cron:

systemctl restart crond

done! you can see if our client is running with the command:

ps axu | grep utopia

result example:

utopiaser     10146  0.0  0.0 112832   972 pts/0    R+   15:21   0:00 grep --color=auto utopia
utopiaser     25365  0.0  0.0 113280  1184 ?        S    jan11   0:00 sh /home/utopiahome/start.sh
utopiaser     25366 63.1 29.9 2990676 1160576 ?     Sl   jan11 6057:39 /opt/utopia/messenger/utopia --headless --configPath=/home/utopiahome/utopia.cfg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment