[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I start a process with i3 exec --no-startup-id /op/bin/externalMonitor.sh

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 12
Thread images: 1

File: pid-300x225.jpg (15KB, 300x225px) Image search: [Google]
pid-300x225.jpg
15KB, 300x225px
I start a process with i3
exec --no-startup-id /op/bin/externalMonitor.sh

script is

#!/bin/bash
intern=eDP1
extern=DP1

while true
do

if xrandr | grep "$extern disconnected"; then
xrandr --output "$extern" --off --output "$intern" --auto
else
xrandr --output "$intern" --off --output "$extern" --auto
fi
sleep1

done


everytime I logout the program is still running though in ps -A

if I logout like 3 times and log back in, I see 3 copies of the program

why isnt it quitting on logout?
>>
>>60903372
Because you're not telling it to quit when you logout.
>>
>>60903599
Aren't all programs launched by the window manager supposed to be terminated when the parent (window manager) is terminated?
>>
>>60903599
how do i do that? isnt this true
>>60903655
>>
>>60903372
it will send a quit message to windowed processes it has up, but wont kill anything else.
check htop in tree mode. processes created by i3 are not children of i3.
>>
>>60904509
ah i see

how do I tell it to quit since its not a child of i3?
>>
make it a systemd service ? or a service in whatever other init system
do you use systemd ?
>>
>>60905128
ok nevermind, thats a bad advice
>>
You need to have it dump a pid file, and at the beginning of the script, an if statement to only run if it isn't running already.
>>
ok i have a usefull advice now
this link teaches you how to run a command at logout:
https://superuser.com/a/65526
and the command you want is:
killall /op/bin/externalMonitor.sh
>>
>>60905151
oh its not, i didnt read the last 3 lines. just make a service !
>>
>>60905050
Ctrl t quits afaik
Thread posts: 12
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.