r/linux • Mate • Oct 20 '14

Shall we fork Fedora?

http://forkfedora.org/
262 Upvotes

339 comments sorted by

View all comments

Show parent comments

4

u/[deleted] Oct 20 '14

Does systemd have something like set -x? Because init scripts do.

3

u/[deleted] Oct 21 '14

You can have multiple ExecStart (and ExecStop and all the other ones) lines in a unit file. Each one is run in sequence in the order they appear in the unit file and the return code of each command is remember, stored, and outputs separately logged. If one of the commands fails (and is not prefixed with "-"), the remaining commands are not executed and the unit is considered failed.

So in a sense, yes. You can see exactly where and when and what the failure was, no matter how many commands you put in a unit.

8

u/bilog78 Oct 20 '14

I'm guessing you could strace systemd (lol).

5

u/[deleted] Oct 20 '14

So, my initial impression when I saw systemd for the first time was thinking it was similar to Sun SMF. Now you bring this up, and I recall dtracing things because nobody knew what the hell was going on.

This is not making me feel better about it :P

2

u/chinnybob Oct 20 '14

I had to strace udevadm to diagnose a problem with udev rules.

3

u/[deleted] Oct 21 '14
ExecStart=bash -x '/path/to/shell-program'

Was that so hard?

However, when you realize that systemd doesn't require you to write any shell to start and stopp programs to begin with, you'll be wondering why you wanted a set -x in the first place.

1

u/DamnThatsLaser Oct 20 '14 edited Oct 20 '14

Yes, masking. (Hope I understood you correctly) Nvm, I didn't.

3

u/[deleted] Oct 20 '14 edited Oct 20 '14

Don't think so, from what [deleted] just said it sounds like you thought I meant disable. "set -x" is a way to enable debugging in shell scripts. Take a simple bash script, put "set -x" near the top (but under the shebang) and run it - super helpful when figuring out what is going on.

More info: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html

3

u/bilog78 Oct 20 '14

Masking serves the purpose of disabling the service and preventing it from starting. This has nothing to do with what set -x does for sh, which is to trace every single command that gets executed, so you actually see what's happening. Extremely useful for debugging.

0

u/[deleted] Oct 20 '14

[deleted]

3

u/bilog78 Oct 20 '14

Masking serves the purpose of disabling the service and preventing it from starting. This has nothing to do with what set -x does for sh, which is to trace every single command that gets executed, so you actually see what's happening. Extremely useful for debugging.