How to start application in tmux on boot?

Hi can anyone show me how to do as title?

I want my qbittorent cli (qbittorent-nox) to run in tmux automatically on system start.
Im running on opensuse 13.1/3.2.

thanks.

(ah. also, I dont know screen and has no intent to use/learn it).

How about turning it into a systemd service?

As root, make a file in /usr/lib/systemd/system/ called qbittorrent-nox.service


[Unit]
Description=qBittorrent-nox
After=network.target


[Service]
Type=forking
User=root
ExecStart=/usr/bin/tmux new-session -d -s qbittorrent-nox qbittorrent-nox
ExecStop=/usr/bin/tmux -c qbittorrent-nox -X quit


[Install]
WantedBy=multi-user.target

Replace User= with your username, don’t run it as root.

systemctl enable qbittorrent-nox.service
systemctl start qbittorrent-nox.service
systemctl status qbittorrent-nox.service

Worked like charm! lol! thanks!

Hi,

Although that works, the recommended place for a local unit file (for the local admins) is inside the directory

/etc/systemd/system

Unless the docs was change, but don’t get me wrong /usr/lib is also fine.

I was hesitating in making the same remark. But I was to lazy to look in the 13.2 docs (I have 13.1 here). IMHO this is a very valuable remark. At least when you want to save your local configuration from being destroyed on some update of systemd.

Good point, although to this date I’ve never had any .service files being removed myself.

On 2015-04-08 15:46, Miuku wrote:
>
> Good point, although to this date I’ve never had any .service files
> being removed myself.

I don’t think any will be removed, unless there is a name clash.
However, it is easier to find your modifications and configurations in
/etc and copy them over to another machine or release.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Did you read the documentation?

On 2015-04-08 19:06, hcvv wrote:
>
> robin_listas;2703739 Wrote:
>>
>> I don’t think any will be removed, unless there is a name clash.
>> However, it is easier to find your modifications and configurations in
>> /etc and copy them over to another machine or release.

On package management? That’s how yast works. General Linux design,
nothing new.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))