So that crontab will read my logic file all the time?

|
armanhrshaikh 2022-09-01 08:18:41
For example-
If I want to schedule
Something for every second Monday for 365 days or every 4th Saturday for 365 days
armanhrshaikh 2022-09-01 08:19:03
These types of schedule made my crontab dirty
marcotrosi 2022-09-01 08:19:35
armanhrshaikh 2022-09-01 08:19:03
These types of schedule made my crontab dirty

https://crontab-generator.org/
https://crontab.guru/

armanhrshaikh 2022-09-01 08:20:32
Thanks, I will invest My whole day
marcotrosi 2022-09-01 08:21:31
armanhrshaikh 2022-09-01 08:18:41
For example-
If I want to schedule
Something for every second Monday for 365 days or every 4th Saturday for 365 days

do you have a screenshot that shows what you mean by “dirty/filthy” ?

marcotrosi 2022-09-01 08:21:50
cause I only know them as one-liners, so nothing dirty about one-liners
armanhrshaikh 2022-09-01 11:29:23
marcotrosi 2022-09-01 08:21:31
do you have a screenshot that shows what you mean by “dirty/filthy” ?

Yeah

armanhrshaikh 2022-09-01 11:30:19
unixusergroup-49983.jpg

armanhrshaikh 2022-09-01 11:52:06
As you can see on top

58 10 * * fri

Every Friday surah Al-kahf file must be executed but I have 15 different files wich should run in sequence for every Friday.

armanhrshaikh 2022-09-01 11:53:52
file1.txt
file2.txt
file3.txt
.
.
.
file15.txt

each file on different Fridays

marcotrosi 2022-09-01 12:02:28
armanhrshaikh 2022-09-01 11:53:52
file1.txt
file2.txt
file3.txt
.
.
.
file15.txt

each file on different Fridays

I mean you can write a script that handles it, and move the logic there instead of having multiple lines in the crontab file. so crontab would be then 1 line for this task, and the logic would be hidden in a script

armanhrshaikh 2022-09-01 12:10:46
So that crontab will read my logic file all the time?
armanhrshaikh 2022-09-01 12:11:04
I am expecting my tasks on termux
Ceda EI 2022-09-01 18:09:00
Tip: You can use all bash flow control statements similar to a command. Each statement has a stdin and a stdout which you can redirect, pipe, etc.

examples:
ls | while read path; do echo “A new file: $path”; done
echo abcd | if [[ $RANDOM -gt 15000 ]]; then cat; else rev; fi | sed ‘s/./&n/g’

A real example I used it in (which made me think that this could be a good tip):
if geometry=$(slurp); then
grim -g “$geometry” –
else
output=$(swaymsg -t get_outputs -r | jq -r ‘.[] | select(.focused) | .name’)
grim -o “$output” –
fi | if [[ $1 == “-e” ]]; then
swappy -f – -o –
else
cat
fi | wl-copy

Two if statements piped into one another and finally into wl-copy

Kueppo 2022-09-01 18:14:06
cool, we usually embed those statements in { } for the purpose of comprehension and readability.
Kueppo 2022-09-01 18:14:59
I’ve seen some usecases on many scripts in /bin.
Ceda EI 2022-09-01 18:30:39
Kueppo 2022-09-01 18:14:06
cool, we usually embed those statements in { } for the purpose of comprehension and readability.

yep. you can always group things in {} in general beyond this too

smol_mazunki 2022-09-01 18:36:29
armanhrshaikh 2022-09-01 11:30:19
unixusergroup-49983.jpg

you can do * for all days, or */3 for every three days

smol_mazunki 2022-09-01 18:36:38
no need to list them all if it’s on a schedule
smol_mazunki 2022-09-01 18:38:40
Ceda EI 2022-09-01 18:30:39
unixusergroup-49983.jpg
yep. you can always group things in {} in general beyond this too

it’s posix, too!

smol_mazunki 2022-09-01 18:42:27
Ceda EI 2022-09-01 18:09:00
unixusergroup-49983.jpg
Tip: You can use all bash flow control statements similar to a command. Each statement has a stdin and a stdout which you can redirect, pipe, etc.

examples:
ls | while read path; do echo “A new file: $path”; done
echo abcd | if [[ $RANDOM -gt 15000 ]]; then cat; else rev; fi | sed ‘s/./&n/g’

A real example I used it in (which made me think that this could be a good tip):
if geometry=$(slurp); then
grim -g “$geometry” –
else
output=$(swaymsg -t get_outputs -r | jq -r ‘.[] | select(.focused) | .name’)
grim -o “$output” –
fi | if [[ $1 == “-e” ]]; then
swappy -f – -o –
else
cat
fi | wl-copy

Two if statements piped into one another and finally into wl-copy

btw, i suggest telling wl-copy about the image type. i recently was on a system where it didn’t induce the mime type automatically

smol_mazunki 2022-09-01 18:42:36
i think it’s because of seatd
smol_mazunki 2022-09-01 18:43:18
grim defaults to png, but can be specified with -t
Ceda EI 2022-09-01 18:44:01
smol_mazunki 2022-09-01 18:42:27
unixusergroup-49983.jpg
btw, i suggest telling wl-copy about the image type. i recently was on a system where it didn’t induce the mime type automatically

works for now and it is a personal script

smol_mazunki 2022-09-01 18:44:25
ya
smol_mazunki 2022-09-01 18:44:57
i have some of these around on my script repos, they’re handy
Ceda EI 2022-09-01 18:46:06
I miss flameshot on wayland tho. They have support for sway but only single monitor support has been added. So, taking a screenshot, it only takes screenshot of left most screen
smol_mazunki 2022-09-01 18:46:53
that’s interesting
smol_mazunki 2022-09-01 18:47:15
i used it a bit on wayland, iirc, but ended up falling back to custom scripts
smol_mazunki 2022-09-01 18:47:50
i abuse my wl-select, wl-select-active, and wl-info scripts
Ceda EI 2022-09-01 18:49:03
https://github.com/flameshot-org/flameshot/issues/2364

Flameshot on Wayland not handling multiple screens · Issue #2364 · flameshot-org/flameshotGitHub
Initial report Flameshot Version Flameshot v11.0.0 () Compiled with Qt 5.15.2 linux: 5.16.5-arch1-1 arch: unknown Installation Type Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, cho…
smol_mazunki 2022-09-01 18:51:28
Ceda EI 2022-09-01 18:49:03
unixusergroup-49983.jpg
https://github.com/flameshot-org/flameshot/issues/2364

have you checked out sway’s grimshot scripts btw?

smol_mazunki 2022-09-01 18:52:02
they’re not very stable, I’ve heard people get coredumps using it lol
Ceda EI 2022-09-01 18:52:16
smol_mazunki 2022-09-01 18:51:28
unixusergroup-49983.jpg
have you checked out sway’s grimshot scripts btw?

yeah, did not try though

Ceda EI 2022-09-01 18:52:21
smol_mazunki 2022-09-01 18:52:02
unixusergroup-49983.jpg
they’re not very stable, I’ve heard people get coredumps using it lol

whew, lmao

|