beating systemctl into submission, script to enhance SERVICE

General support questions
Post Reply
_ck_
Posts: 89
Joined: 2012/08/10 23:00:35

beating systemctl into submission, script to enhance SERVICE

Post by _ck_ » 2014/08/21 00:17:54

I am still not warming up to systemd or systemctl so I wrote a script to enhance the service command on CentOS 7

Would appreciate feedback and improvements since my bash-fu is not that great.

https://gist.github.com/ck-on/b7d5849787c8cdf398b5

Basically you save it to /usr/local/bin/service and chmod +x /usr/local/bin/service
and then run hash -d service once (to make centos stop using native service command first)

Then you get these little bonuses:
1. status runs automatically after commands instead of an empty response to see if it really started/stopped
2. journalctl log is shown so after a start you can actually see messages from the daemon/process (which systemctl hides)
3. ansi color is selectively added to special keywords
4. you can add back custom commands like service nginx configtest (I also have mysql configtest in there)
5. shortcuts like service reload instead of trying to remember systemctl daemon-reload

I know it is not for everyone but give me a few years to get comfortable with systemd and systemctl

I am working on a chkconfig replacement inside of it that does easier to read output for both init.d and systemd services

User avatar
centminmod
Posts: 44
Joined: 2014/07/12 14:28:06
Location: Brisbane, Australia
Contact:

Re: beating systemctl into submission, script to enhance SER

Post by centminmod » 2014/08/25 04:55:05

interesting approach there ck

I did something similar but map the systemctl and init.d equivalents for my Centmin Mod LNMP installer script https://community.centminmod.com/thread ... -vps.1202/. But I only mapped them for my script itself so it isn't permanent within SSH.

Might look into your approach for Centmin Mod .08 betas and more permanent approach. No Centmin Mod users have complained yet - probably not enough CentOS 7 users yet heh

Post Reply

Return to “CentOS 7 - General Support”