DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 9th March 2017
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
 
Join Date: Oct 2013
Location: EST USA
Posts: 314
Default Start rtorrent in tmux from rc.local at boot-time

Hi,

I would like to share several datasets via net/rtorrent from a headless OpenBSD server:

$ uname -a
Code:
OpenBSD lucidrine.bohemia.net 6.0 GENERIC#1 i386
I am trying to devise a setup that will share the datasets whenever the computer is on. rtorrent runs as a regular user with a curses (text/terminal) interface. I interact with this headless machine via ssh and tmux. So, what I would like to do is start a tmux server at boot-time as the regular user and start rtorrent in a pseudo terminal in that tmux session.

This is what I've tried so far (it doesn't work):
/etc/rc.local
Code:
doas -u hanzer tmux new-session rtorrent
/etc/doas.conf
Code:
# Non-exhaustive list of variables needed to
# build release(8) and ports(7)
permit nopass setenv { \
        FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK \
        DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF \
        MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR \
        PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR SHARED_ONLY \
        SUBPACKAGE WRKOBJDIR SUDO_PORT_V1 } :wsrc
permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
permit nopass keepenv root
/home/hanzer/.tmux.conf
Code:
set -g history-limit 2000
set-option -g status-bg white
set-option -g status-fg black
new-session -n $HOST
set -g status-right '#H #(date +"%Y-%m-%d %a %H:%M")'
rtorrent and pf are configured and working.

My experience with tmux is somewhat superficial. Any ideas?
Reply With Quote
  #2   (View Single Post)  
Old 10th March 2017
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 307
Default

You didn't say what about it doesn't work. Or if anything works when done manually. But the net/syncthing pkg-readme has a recipe for doing what you want to do from cron:

Quote:
It might be desirable to have Syncthing executed on system reboot for each user individually. To achieve this a crontab entry can be created on per-user basis:

@reboot tmux new-session -d '/usr/local/bin/syncthing'

This will result in a new tmux(1) session being spawned each system boot. The user can later use `tmux attach` to view and control their Syncthing process.
Reply With Quote
  #3   (View Single Post)  
Old 10th March 2017
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
 
Join Date: Oct 2013
Location: EST USA
Posts: 314
Thumbs up SOLVED

Thanks!

man 5 crontab describes the @reboot option. With that hint, I did this:

$ crontab -e
Code:
SHELL=/bin/ksh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
HOME=/home/hanzer
#
#minute (0-59)
#|   hour (0-23)
#|   |    day of the month (1-31)
#|   |    |   month of the year (1-12 or Jan-Dec)
#|   |    |   |   day of the week (0-6 with 0=Sun or Sun-Sat)
#|   |    |   |   |   commands
#|   |    |   |   |   |
23   *    *   *   *   wget -O - "http://freedns.afraid.org/dynamic/update.php?REDACTED" >> /tmp/freedns.log 2>&1 &
@reboot               tmux new-session -d 'rtorrent'
And it does exactly what I needed. Thanks again!

Last edited by hanzer; 10th March 2017 at 02:33 AM. Reason: spelling
Reply With Quote
  #4   (View Single Post)  
Old 10th March 2017
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 654
Default

If you like, you should be able to click the thread tools link at top and mark the topic solved.
Thanks for coming back and sharing how you fixed it.
Reply With Quote
  #5   (View Single Post)  
Old 11th March 2017
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
 
Join Date: Oct 2013
Location: EST USA
Posts: 314
Default

Quote:
Originally Posted by scottro View Post
If you like, you should be able to click the thread tools link at top and mark the topic solved.
The Thread Tools menu doesn't seem to have that option

Quote:
Originally Posted by scottro View Post
Thanks for coming back and sharing how you fixed it.
That's how we roll
Reply With Quote
  #6   (View Single Post)  
Old 11th March 2017
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 408
Default

Quote:
Originally Posted by hanzer View Post
The Thread Tools menu doesn't seem to have that option
So, just change the topic title, and add [Solved]
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
  #7   (View Single Post)  
Old 11th March 2017
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 654
Default

Sorry, the Fedora forums which uses a similar interface, has it. (Or at least had it, I don't know if upgrades have removed it, and I know there are some slight differences--not sure if this one or Fedora is newer.)
Reply With Quote
  #8   (View Single Post)  
Old 13th March 2017
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
 
Join Date: Oct 2013
Location: EST USA
Posts: 314
Default

Quote:
Originally Posted by LeFrettchen View Post
So, just change the topic title, and add [Solved]
Hmm, in what color should be this [s]bikeshed[/s] "[Solved]" label?

Or more importantly, why doesn't the BBCode for strikethrough text render properly?
Reply With Quote
  #9   (View Single Post)  
Old 14th March 2017
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,319
Default

Quote:
Originally Posted by hanzer View Post
Or more importantly, why doesn't the BBCode for strikethrough text render properly?
The strike-through tag supported here is [del], not [s]. As an example, strike-through.

Supported BBCode tags are discussed in the Forum rules.
Reply With Quote
Old 14th March 2017
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
 
Join Date: Oct 2013
Location: EST USA
Posts: 314
Default

Quote:
Originally Posted by ocicat View Post
Supported BBCode tags are discussed in the Forum Info Thread.
Supa-cool, and bookmarked.

After spending a little more time with the "[Solved]" label issue this thread, I am inclined to Paint it black.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
rc script to start and stop a local ssh socks connection gso Programming 0 15th September 2015 12:14 PM
Issues with rc.local file (and getting CUPS to start at boot time) Biased OpenBSD General 7 13th January 2014 01:50 PM
Cannot start program in rc.local guitarscn OpenBSD General 2 8th November 2010 01:10 PM
firefox/thunderbird take very long time (~45s) to start caesius FreeBSD Ports and Packages 4 28th November 2008 12:04 AM
Can start rtorrent like apache and mysql when system boot mfaridi FreeBSD Ports and Packages 0 26th November 2008 09:27 AM


All times are GMT. The time now is 06:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick