[CentOS] Systemd and systemd-sysv-generator

Mike - st257 silvertip257 at gmail.com
Wed Dec 30 17:08:22 UTC 2015


On Wed, Dec 30, 2015 at 10:47 AM, James Hogarth <james.hogarth at gmail.com>
wrote:

>
> > > Can you pastebin the init script by any chance? I wonder if it's
> > actually a
> > > properly written init script or if it's bad enough  that the generator
> > > fails to parse it ...
> >
> >
> > Yes - here is a pastebin with that script.
> >
> > And there was an error on line 130 ... or line 133 of the pastebin --
> which
> > I already fixed. ;-)
> > (I verified the typo against the contents of the RPM from LSI to be
> > certain.)
> > if ( "$rhel_ver" == "1" && "oel_ver" == "0" ) ; then
> > should have been
> > if ( "$rhel_ver" == "1" && "$oel_ver" == "0" ) ; then
> >
> >
> > http://pastebin.com/BGLjGiuT
> >
> >
> >
> That doesn't even make sense ... if it's both rhel and oel version 7 then
> systemctl start <Service>  ... :/
>
> Some lovely samples from it:
>  #A function to stop a program.
> statuscheck() {
>
> Let's import the standard distro function library! then ...
> mykillproc()
> {
>
>
> Okay we might have a pid we think ... better kill it ...
>
>                kill -TERM $pid
>                usleep 200000
>                if ps h $pid >/dev/null  >/dev/null 2>&1 ; then
>                 sleep 1
>                 if ps h $pid >/dev/null  >/dev/null 2>&1 ; then
>                         sleep 3
>                ...
>
> Hmm we have a snmpd dependency...
> if [ -x /etc/init.d/snmpd ] ; then
>             /etc/init.d/snmpd start
>
> ./twitch && ./vomit
>
> That's so badly written it wouldn't surprise me if it just barfed and gave
> up ...
>

I guess that syntax error I found should have been a tip-off.
Thanks for analyzing LSI's SysV init script. ;-)

I didn't take the time to do that before you asked for a pastebin. I
appreciate the help.


>
> According to
>
> https://github.com/systemd/systemd/blob/master/src/sysv-generator/sysv-generator.c
> though the journal (or syslog) should contain a Failed to create unit file
> <foo> if it couldn't translate it though ...
>

I briefly looked at (and grepped) logs and didn't find a message about
failing to create unit file.


>
> I'd seriously just give up on that and do the 3-5 line systemd unit that is
> soo much cleaner ... you could even have a proper snmpd.service dependency
> in place then!


Sounds like the best path.

Thank you everyone.

-- 
---~~.~~---
Mike
//  SilverTip257  //



More information about the CentOS mailing list