Results 1 to 9 of 9

Thread: How to start application in tmux on boot?

  1. #1
    Join Date
    Sep 2014
    Location
    Shah Alam, Malaysia
    Posts
    68

    Default 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).

  2. #2
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: How to start application in tmux on boot?

    How about turning it into a systemd service?

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

    Code:
    [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
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  3. #3
    Join Date
    Sep 2014
    Location
    Shah Alam, Malaysia
    Posts
    68

    Default Re: How to start application in tmux on boot?

    Quote Originally Posted by Miuku View Post
    How about turning it into a systemd service?

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

    Code:
    [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! thanks!

  4. #4

    Default Re: How to start application in tmux on boot?

    Hi,

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

    Code:
    /etc/systemd/system
    Unless the docs was change, but don't get me wrong /usr/lib is also fine.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,890

    Default Re: How to start application in tmux on boot?

    Quote Originally Posted by jetchisel View Post
    Hi,

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

    Code:
    /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.
    Henk van Velden

  6. #6
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: How to start application in tmux on boot?

    Good point, although to this date I've never had any .service files being removed myself.
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How to start application in tmux on boot?

    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))

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,890

    Default Re: How to start application in tmux on boot?

    Quote Originally Posted by robin_listas View Post
    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?
    Henk van Velden

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How to start application in tmux on boot?

    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))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •