[Cialug] The systemd Init System

Todd E Thomas todd.dsm at gmail.com
Mon Feb 15 17:20:06 CST 2016


@kristau: Getting a modified time is as simple as calling a function that
contains a line like:
fsoModTm="$(stat -c '%y' $1 2>/dev/null)"

Where the file name is passed as the argument "$1". There are lots of
printing/format options
<http://www.gnu.org/software/coreutils/manual/html_node/stat-invocation.html#stat-invocation>
 though.

Also, formatting output is as easy as experimenting with printf
<https://linuxconfig.org/bash-printf-syntax-basics-with-examples>. The echo
program just doesn't have the flexibility that printf offers
<http://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html>. The
upside you'll notice is that if you learn printf, these formatting rules
tend to extend from C (and derivatives) to Bash, Python, and many other
languages that call this library. Learn once, use many.
---

@Walton props on the wooledge bash wiki reference; the guy that writes the
bash language contributes to these pages AND hangs out in the same #bash
IRC channel as Greg Wooledge. It's one of the few places to get reliable
(tested) explanations. Ironic that I didn't reference it once (this time).
---

Back to the subject line, I see a lot of non-technical oppositions to
systemd; IE: I don't want to learn something new. The answer, you're
already using it or you're not:

if you see something like this:

*$ sudo service sshd restart; echo $?*  # System V style
... (lots of output)
*Redirecting to /bin/systemctl restart  sshd.service*
0

Then you are on systemd. The line in blue indicates than your request is
being passed (via wrapper) to systemd.

*This is only a convenience*; it exists so you have time to go through your
scripts and update them. When it goes away, it's gone.

Service/chkconfig are only there for humans; they no-longer have any
technical purpose. As evidenced by:

$ chkconfig --list ssh

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by
native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
...

Fedora/Debian have already implemented systemd. That means their new
versions, and all derivatives, already have it. This is 90% of the Linux
pie. But more beyond that, the future has only ever held 3 options for any
of us:

   - Ride the wave
   - Redirect the wave (voice your opinions at steering meetings), or
   - Get crushed by the wave

Since the future can't be stopped all the agonizing along the way only
represents unnecessary overhead.

TT


On Fri, Feb 12, 2016 at 4:02 PM, kristau <kristau at gmail.com> wrote:

> This Very Much:
>
> "Even better, put the modification time in the filename, in YYYYMMDD
> format, so that glob order is also mtime order. Then you don't need ls
> or perl or anything. (The vast majority of cases where people want the
> oldest or newest file in a directory can be solved just by doing
> this.)"
>
> On Fri, Feb 12, 2016 at 1:08 PM, Todd Walton <tdwalton at gmail.com> wrote:
> > On Wed, Dec 16, 2015 at 11:48 AM, Todd Walton <tdwalton at gmail.com>
> wrote:
> >
> >>
> >> Huh. I was about to respond to Scott in this way, but you beat me to it,
> >> Jim. Although I'd probably say it died soft, not hard. The remnants are
> >> still there.
> >>
> >> The root problem, imho, is that the "one thing" unit needs to be
> >> refactored, updated for the modern age. And text output is great at the
> end
> >> of the pipe, but it's not always great for the core utils talking to
> each
> >> other, so you get things like find with the mutant arms of -exec and
> >> -print0.
> >>
> >> And oh how I wish someone would rewrite ls to sort better, align better,
> >> etc.
> >>
> >
> > And on that note... Enumerating files or doing stuff with files:
> > http://mywiki.wooledge.org/ParsingLs
> >
> > ===============
> > # Good!
> > for f in *; do
> >     [[ -e $f ]] || continue
> >     ...
> > done
> > ===============
> > ===============
> > # BAD! Don't do this!
> > for f in $(ls); do
> >     ...
> > done
> > ===============
> >
> > *cough* objects *cough*
> >
> > --
> > Todd
> > _______________________________________________
> > Cialug mailing list
> > Cialug at cialug.org
> > http://cialug.org/mailman/listinfo/cialug
>
>
>
> --
> Tired programmer
> Coding late into the night
> The core dump follows
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list