0 points

I thought someone here had mentioned that the environment and user executing the script at startup and you running the script might have differences. The reason it would have worked with systemd might be that the environment was loaded correctly?

permalink
report
reply
1 point

Why should the environment make a difference when it comes to receiving the SIGINT when the process gets killed?

permalink
report
parent
reply
2 points

They responded to the wrong post. They’re likely thinking of the auto start post.

permalink
report
parent
reply
1 point

Oops yeah you’re right. Sorry OP. There’s nothing better than using a database that flushes to disk often enough that missing a small chunk of data due to interruptions should be fine. Probably some kind of memory mapped IO on top of eager writing filesystem should do a good enough job.

permalink
report
parent
reply
2 points

I didn’t know why a person would go to these lengths to deal with a misbehaving computer, as compute devices are generally for work, and need to work in order to do work, and any kind of crash is going to get my entire focus until it is banished to Hades…

…but then, learned something along the way I probably otherwise would not have, because of @bleistift2@sopuli.xyz’s tenacity.

permalink
report
reply
1 point

Missed opportunity to make the last panel have her eyes closed (or just be fully black).

permalink
report
reply
3 points

My computer has a problem where occasionally it will become completely unresponsive. (Mouse cursor doesn’t move. Keys have no apparently effect. Whatever app is running freezes. I think its a hardware problem with the graphics card, but I don’t know what. Logs at the time it freezes say “the GPU has fallen off the bus”.)

Anyway… I recently learnt about Magic SysRq. And I’ve been able to shutdown the computer from this unresponsive state with SysRq, R E I S U O. Where as I understand it, the “E” tells processes the end nicely if they can; and then the “I” just ends them by force.

(At this point, I’m realising that the E is SIGTERM, not SIGINT - so that screws up the relevance of my story; but I figure I’ll keep going anyway.)

The point is, I’ve been using key combo with a nice pause between each key, thinking there was some chance that processes might be ending gracefully. But when I tried it while the computer wasn’t frozen, the computer was able to inform me that the E and I commands were disabled. (I don’t know why.) So even though I wanted to give a nice “please end” signal, in the end that just wasn’t happening.

permalink
report
reply
1 point

You could try enabling systemd-oomd. It’s a userspace OOM killer and seems to be aggressive enough to mostly stop that from happening.

permalink
report
parent
reply
5 points

I realise I’m late to the party and you’ve alreadu gone the systemd unit way, but had your script trapped sigterm to begin with?

permalink
report
reply
5 points

When I run the script myself and kill it, it gets the signal and acts correctly. Only when I poweroff the system, this doesn’t work.

permalink
report
parent
reply
7 points

SIGINT is sent when you press Ctrl+C. SIGTERM is sent in just about every other situation - basically when the system wants the program to end. For instance when systemd wants to stop the service or the default signal with programs like kill pkill htop etc. You should catch both of these signals.

permalink
report
parent
reply
2 points

I did try to catch all of these signals:

                | "SIGABRT"
                | "SIGALRM"
                | "SIGBUS"
                | "SIGCHLD"
                | "SIGCONT"
                | "SIGFPE"
                | "SIGHUP"
                | "SIGILL"
                | "SIGINT"
                | "SIGIO"
                | "SIGIOT"
                | "SIGKILL"
                | "SIGPIPE"
                | "SIGPOLL"
                | "SIGPROF"
                | "SIGPWR"
                | "SIGQUIT"
                | "SIGSEGV"
                | "SIGSTKFLT"
                | "SIGSTOP"
                | "SIGSYS"
                | "SIGTERM"
                | "SIGTRAP"
                | "SIGTSTP"
                | "SIGTTIN"
                | "SIGTTOU"
                | "SIGUNUSED"
                | "SIGURG"
                | "SIGUSR1"
                | "SIGUSR2"
                | "SIGVTALRM"
                | "SIGWINCH"
                | "SIGXCPU"
                | "SIGXFSZ"
                | "SIGBREAK"
                | "SIGLOST"
                | "SIGINFO";
permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 3.6K

    Monthly active users

  • 1.1K

    Posts

  • 39K

    Comments