command line – Run a piece of code in the background while using a script

Hey there I have a (for me atleast) complicated question.

I have a script that interacts with the plex (and sonarr but that isn’t important) api. I made it look and work like an interface. See the pictures:

I run the script and this is the first thing I see:

Home page

I choose to interact with the plex api and get to see the following page:

Home page plex api

There appears to be an update available for pms so I select “update”:

Updating but someone is using plex

But someone is watching a movie or series. So it doesn’t update because updating shuts down pms which would stop the stream of that person. So I made the script show that message when that happens (instead of updating). It shows it for 10 seconds and after that you go back to the menu in picture 2.

When nobody is streaming, it just goes through the update process and after that brings you back to Home page Plex API.

Now comes the question

I want to make an option called notify (an option like I could choose “plex” and “update” and now I want “notify”). So at the bottom of the message in picture 3, I would have exit | back | notify: (instead of sleeping 10s and going to Home page Plex API).

When I choose that option, it needs to run some code in the background. So it immediately goes back to Home page Plex API but in the background, it checks every 2 minutes if there’s still anybody watching. And when there isn’t anymore, it sets a variable to false.

But the problem for me is “in the background”. I want to run that piece of code in the background so that I could use the script in the mean time. So I choose “notify” and am then immediately able to use the script again. I can do (aka choose options/access parts of the api) anything I want, while in the background that part of code is running. And after it detects that that variable is set to false, it stops running in the background.

Do you have any idea how to do this?

Normally I’m already trying things and testing out if something works but with this problem, I really don’t know what to do/where to begin.

r – two way repeated measures anova won’t run, returns errors that do not make sense for all 3 functions tried

I am very new to R and am trying some tutorials for two way anova online that I think should work based on my data and the example data given, however I get error messages that do not make sense to me. Any help would be appreciated. data and code below. I tried using both anova_test function from the Rstatix package and the AOV function, and the ezanova function from EZ package. My understanding of the principals are pretty shaky so I may be unaware of some limitation? code structure and data below. What am I missing?? Thank you for any help. (I apologize for the messy code, I have been trying many things for days to get this…)

tibble (57 x 5) (S3: tbl_df/tbl/data.frame)
 $ Population: chr (1:57) "S1" "S2" "S3" "S4" ...
 $ Pop_1983  : num (1:57) 3.4 7.5 10.2 5.1 4.8 54.4 9.9 6.5 38.2 56.3 ...
 $ Pop_1986  : num (1:57) 3.6 7.6 9.9 5.1 4.9 55.4 10 6.5 38.8 56.6 ...
 $ Pop_1990  : num (1:57) 3.5 7.64 9.91 5.13 4.98 ...
 $ Fertilizer: chr (1:57) "A" "A" "A" "A" ..


#compile time variables into one column
dfpopcomp <- dfpop %>% gather(key = "time", value = "Pop_measure", `83pop`, `86pop`, `90pop`)
ggboxplot(dfpopcomp, x = "time", y = "Pop_measure",color = "fertilizer", palette = c("#ff0000", "#0000ff","#00ff00")) #boxplot
#very high outliers?
dfpopcomp%>%group_by(time, fertilizer)%>%identify_outliers(Pop_measure)#outliers present, pops:s23,s24,s40, they are consistent outliers in all years 
#check normality
dfpopcomp %>% group_by(time, fertilizer) %>% shapiro_test(Pop_measure)
#ggqqplot(dfpopcomp,"Pop_measure", = "time")
ggqqplot(dfpopcomp, "Pop_measure", ggtheme = theme_bw()) + facet_grid(time ~ fertilizer, labeller = "label_both")
#P value indicates normality, though plots indicate some deviation from normality
#repeated measure anova
# trial 1 won't run
#works but ignores fertilizer as a variable #pop.anova<-anova_test(data=dfpopcomp,dv = Pop_measure, wid=pop,within = time)
pop.anova<- anova_test(data = dfpopcompadj, dv = Pop_measure, wid = pop, within = c(fertilizer,time)) #returns 0 (non-na) cases all false

lm(Pop_measure~time:fertilizer,data = dfpopcompadj)

#Trial 2 won't run
pop.aov<-aov(Pop_measure~time*fertilizer+Error(Pop/(time+fertilizer)),data = dfpopcompadj)
#returns model is singular

#trial 3
q5t3model<-ezANOVA(data = dfpopcompadj,dv=Pop_measure,wid = pop,within = C(fertilizer,time),detailed = TRUE,type = 2)
#returns one or more cells missing data, but they all have data

Debian server unable to run Certbot

root@vps434142:~# certbot 
Traceback (most recent call last):
  File "/usr/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 3017, in <module>
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 3030, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 659, in _build_master
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 967, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 853, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'certbot==0.28.0' distribution was not found and is required by the application

Getting different results with `Abort` run in the documentation window vs a notebook (probably newlines)

I’m getting different results with respect to Abort when performed in a reference documentation notebook vs a new notebook. I am pretty confident it’s to do with the newlines I introduced in my new notebook, because it all works fine when I collapse it back onto one line.

In(12):= ClearAll(a); ClearAll(b);

In(13):= Print(a);

During evaluation of In(13):= a

Out(14)= $Aborted

During evaluation of In(13):= hi

But in the documentation window for “tutorial/InterruptsAndAborts”, the first evaluable cell:

In(3):= Print(a); Abort(); Print(b)

During evaluation of In(3):= a

Out(3)= $Aborted

I’ve checked Hold(<that>) // FullForm // CopyToClipboard and they are not identical, though they do display identically: in my notebook, it’s a TagBox monstrosity:

RowBox({"Hold", "(", 
RowBox({"CompoundExpression", "(", 
RowBox({"Print", "(", "a", ")"}), ",", 
RowBox({"Abort", "(", ")"}), ",", 
RowBox({"Print", "(", "b", ")"})}), ")"}), ")"}),

Whereas in the documentation window it’s precisely:

Hold(Print(a); Abort(); Print(b))

Question: why are newlines causing different behaviour with respect to Abort here? I am strongly inclined to call this a bug, because the FullForm of the expression with newlines displays identically to the FullForm of the expression without newlines; it’s only when you attempt to copy the held output (e.g. with CopyToClipboard) that you discover they’re different.

My version:

In(12):= $Version
Out(12)= "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)"

(This odd behaviour discovered while trying to answer Stop a script. Just stop it .)

permissions – How to run Termux commands from adb

I am trying to run the tshark command I have set up in Termux from the adb shell. I set up termshark by running the following commands:

pkg install root-repo
pkg install termux-api
pkg install termshark

After running those I was able to just run tshark as a command in Termux. I am now trying to run the tshark command through an adb shell. tshark is located at /data/data/com.termux/files/usr/bin/tshark but when I try to run that in adb I get a message saying the following

1|generic_x86_arm:/ $ /data/data/com.termux/usr/bin/tshark    
/system/bin/sh: /data/data/com.termux/usr/bin/tshark: inaccessible or not found

My Android device is not rooted, is there a way to access this command without rooting my device?

Ubuntu 20.04 – Run monitors only IGFX and OC Nvidia GPU without offloading

I would like to run my two monitors in the Intel HD card and run the mining software in the GPU, with OC.

However Ubuntu 20.04 offload the video to the Nvidia card by default, when running the mining software my display freezes from time to time due to the load.

I can successfully avoid this by following some instructions to run the kernel with nogpumanager and adding just the intel driver in xorg.conf

That works great EXCEPT that I can’t OC the card any more, as PowerMizer becomes unusable.

Any tips on how to configure this setup? thank you

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2486 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 228b (rev a1)