In retrospect, command -v seems to be more portable than which[1]. So
a better version would be:
if command -v tmux >/dev/null 2>&1; then
# if not inside a tmux session, and if no session is started, start
# a new session
test -z "$TMUX" && (tmux attach || tmux new-session)
fi
Though I supp
On 20/10/07 02:34PM, ben wrote:
> Hello, Misc;
>
> I'm attempting to write an rc script to start a tmux session:
What problem are you trying to solve by using an rc script?
I have this in my .kshrc for automatic tmux sessions:
if which tmux >/dev/null 2>&1; then
# if not inside a tmux session,
>So, if you have edited the script to add a pexp *after* starting
>it, you'll need to remove that /var/run file otherwise it will
>still use the old one or the default.
I've checked the /var/run file for the script name and pexp, and everything was
in place; I made sure to first change the pexp va
On 2020-10-07, ben wrote:
>>I think you might need a pexp variable, process grep expression to be used b
>>y pgrep to determine if the service is running.
>
> I've tried using pexp, the result is the same; I can start the script and
> receive the 'tmux(ok)' message, but upon running the '/etc/rc.d
>I think you might need a pexp variable, process grep expression to be used b
>y pgrep to determine if the service is running.
I've tried using pexp, the result is the same; I can start the script and
receive the 'tmux(ok)' message, but upon running the '/etc/rc.d/tmux stop'
I receive no messages
> On Oct 7, 2020, at 2:35 PM, ben wrote:
>
> Hello, Misc;
>
> I'm attempting to write an rc script to start a tmux session:
>
>#!/bin/sh
>
>daemon="/usr/bin/tmux"
>daemon_flags=" new -d -s MAINTMUX -n SHELL"
>
>. /etc/rc.d/rc.subr
>
>rc_reload=NO
>
>rc_stop() {
>
Hello, Misc;
I'm attempting to write an rc script to start a tmux session:
#!/bin/sh
daemon="/usr/bin/tmux"
daemon_flags=" new -d -s MAINTMUX -n SHELL"
. /etc/rc.d/rc.subr
rc_reload=NO
rc_stop() {
/usr/bin/tmux kill-session -t MA
7 matches
Mail list logo