โ prev | next โ
andykluger 2022-07-19 06:01:03
There’s some event you want to watch for, and when it happens you want to respond by adding a scheduled task to cron? I think I’m getting that wrong but what exactly do you want to catch or respond to?
smol_mazunki 2022-07-19 06:45:14
armanhrshaikh 2022-07-19 05:24:01
Is it possible to catch the running process and schedule in crontab in real time.
E.g
python event.py
๐This one is running and I want this to continue forever.
Thanks
/proc/${pid}/cmdline will tell you the command line which was used
smol_mazunki 2022-07-19 06:45:31
/proc/$(pidof python)/cmdline if it’s the only one
smol_mazunki 2022-07-19 06:45:51
but it sounds kind of weird what you’re attempting
smol_mazunki 2022-07-19 06:47:00
if you have run a command, and wanted to run it in a loop instead but don’t want to wait until it finishes
smol_mazunki 2022-07-19 06:47:32
most shells/terms allow you to buffer the input, unless the keyboard is trapped
smol_mazunki 2022-07-19 06:47:51
so just type while true; do !!; done
smol_mazunki 2022-07-19 06:47:55
and hit enter
smol_mazunki 2022-07-19 06:48:10
it’ll run once the program you were waiting to complete finishes
armanhrshaikh 2022-07-19 07:53:18
smol_mazunki 2022-07-19 06:45:51
but it sounds kind of weird what you’re attempting
So that’s not possible?
smol_mazunki 2022-07-19 07:53:40
armanhrshaikh 2022-07-19 07:53:18
So that’s not possible?
i didn’t fully understand what your end goal here is
armanhrshaikh 2022-07-19 07:55:20
Can we us a running process inside crontab ?
nrr_us 2022-07-19 07:56:59
armanhrshaikh 2022-07-19 05:24:01
Is it possible to catch the running process and schedule in crontab in real time.
E.g
python event.py
๐This one is running and I want this to continue forever.
Thanks
I’m not sure I fully understand this question.
marcotrosi 2022-07-19 08:04:06
armanhrshaikh 2022-07-19 05:24:01
Is it possible to catch the running process and schedule in crontab in real time.
E.g
python event.py
๐This one is running and I want this to continue forever.
Thanks
to me it sounds like the event.py should be written in a way that it runs forever, like a daemon thing.
nrr_us 2022-07-19 08:09:30
marcotrosi 2022-07-19 08:04:06
to me it sounds like the event.py should be written in a way that it runs forever, like a daemon thing.
That isn’t strictly necessary. I’d probably be keener to drag something like runit or s6 into the picture anyway. When the Python script exits, the process supervisor will just stand it back up again.
You’d still have that problem with a poorly-written daemon.
n0madcoder 2022-07-19 10:39:52
I have a question regarding sed|awk.
I have a bunch of text data that follows this pattern:
Plant name
Index:
Description
Origin
Related species
History
*description*
How should I map the range from plant name to the new line before *description* being aware that the index it’s not the same length for each data block?
Is it possible with sed? Or do I need some combination with awk?
The goal is to delete that block once selected
marcotrosi 2022-07-19 10:43:32
n0madcoder 2022-07-19 10:39:52
I have a question regarding sed|awk.
I have a bunch of text data that follows this pattern:
Plant name
Index:
Description
Origin
Related species
History
*description*
How should I map the range from plant name to the new line before *description* being aware that the index it’s not the same length for each data block?
Is it possible with sed? Or do I need some combination with awk?
The goal is to delete that block once selected
will it be a script that runs often or is it a one-time-job?
n0madcoder 2022-07-19 10:46:23
marcotrosi 2022-07-19 10:43:32
will it be a script that runs often or is it a one-time-job?
Only on demand, triggered by the user
marcotrosi 2022-07-19 10:55:28
I’m trying to figure out how the relative offsets after a pattern can be done like in Vim
marcotrosi 2022-07-19 10:55:37
but it seems it’s not possible in sed
n0madcoder 2022-07-19 11:01:49
marcotrosi 2022-07-19 10:55:37
but it seems it’s not possible in sed
Ouch
marcotrosi 2022-07-19 11:02:07
I’m still investigating
marcotrosi 2022-07-19 11:02:22
there are some other ways I guess
n0madcoder 2022-07-19 11:05:02
Thanks! I’ve spent the whole afternoon yesterday trying to figure it out with sed. Another option could be doing it in python (or similar) maybe?
marcotrosi 2022-07-19 11:06:08
of course, with vim easily, yes also on commandline with vim. you would treat vim like sed
marcotrosi 2022-07-19 11:06:36
but now I’m learning new stuff about sed and I want to able to use it for the scenario
marcotrosi 2022-07-19 11:16:22
n0madcoder 2022-07-19 10:39:52
I have a question regarding sed|awk.
I have a bunch of text data that follows this pattern:
Plant name
Index:
Description
Origin
Related species
History
*description*
How should I map the range from plant name to the new line before *description* being aware that the index it’s not the same length for each data block?
Is it possible with sed? Or do I need some combination with awk?
The goal is to delete that block once selected
sed ‘/Plant/,/description/{/description/!d}’
marcotrosi 2022-07-19 11:16:26
try this
marcotrosi 2022-07-19 11:16:35
hoping I understood you correctly
n0madcoder 2022-07-19 11:17:16
oh, wow! Let me try
n0madcoder 2022-07-19 11:20:20
hmm, it throws extra characters at the end of d command. That happened yesterday with the i command too. I’m looking how to solve it
marcotrosi 2022-07-19 11:20:44
oh wait
marcotrosi 2022-07-19 11:21:10
I used “description” but you meant description as a placeholder for whatever text may come, right?
marcotrosi 2022-07-19 11:21:24
then my solution wont work
n0madcoder 2022-07-19 11:21:37
No, no. It’s working now!
โ prev | next โ