Guy: - "Your restart script doesn't work."
Me: - "What do you mean?"
Guy: - "It does nothing."
Me: - "It should kill every processes that's running within the project and start them again. Wait... Why do you terminate it?"
Guy: - "I don't. It just stops."
Me: - "It says `Terminated` here. You killed it. Just let it do it's job, don't kill it."
Guy: - "I'm not killing it! It just stops!"

(...two hours later...)

Me: - "Wait... Where do you run it from?"
Guy: - "What do you mean? I just run the script you gave me."
Me: - "Yeah, but where do you run it from? Where did you put it?"
Guy: - "It's part of the project so I put it in the project, d'oh!"

  • 10
    If you didn't facepalm at this point - the script does this before anything else:

    > pkill -f projectName

    ...so it's okay to call it like this:

    > ./script.sh

    ...but it's not okay to call it like this:

    > projectName/script.sh
  • 1
    @jespersh Don't tempt me...
  • 3
    Run a conditional on the exact syntax of $0, and whine/exit if it's not correct.
  • 2
    Seems like a shitty script
  • 0
    @NotWhoIUsedToBe It's not supposed to be "good". It's for old people who refuse to use docker and give bullshit excuses. Nevertheless, it's not hard to debug a script when the issue is glaring at you from the very first line of the code.
  • 1
    If my script was so bad it was killing itself i wouldn't blame the user. Own up to your own mistakes.
  • 1
    But it's a funny scripting mistake to make i will give you that
  • 1
    @NotWhoIUsedToBe Oh, I don't deny it's shitty. I meant it was written in haste and following the path of least resistance so... yeah, funny mistakes were bound to happen. Never meant to make it user-proof. Just didn't think I'll be the user.
  • 0
    @cprn yes, because old people don’t use docker and docker is necessary to run applications well </sarcasm>
  • 0
    @cprn why would you write a script if it’s not meant to be used? You couldn’t run it programmatically as it’d just kill itself
  • 0
    @xalys It was meant to be run by people who bugged me about making a run script that doesn't need Docker. And it works fine when used as per instructions, i.e. it's not part of the project and cannot be run within the project because it's supposed to kill all parts of said project so yes, when it itself is a part of the project it suicides. I don't know which part you don't get but I understand you felt offended because I said old people don't use Docker. Well, in my experience, they don't.
Add Comment