1

In all honesty, I don't feel comfortable at all using systemd. I just can't understand it.

I was using a version of fail2ban that was behaving strangely in my Ubuntu 16.04. I removed it:

apt remove fail2ban

and installed the last one:

wget https://github.com/fail2ban/fail2ban/archive/0.11.zip
unzip 0.11.zip
cd fail2ban-0.11
python setup.py install

At the end of its installation it said I had to enable its service.

I thought that

systemctl enable fail2ban.service

was enough, but it seemed like the service was "masked". I used this link: https://askubuntu.com/questions/710420/why-are-some-systemd-services-in-the-masked-state to understand what masked is.

I tried to unmask it: systemctl unmask fail2ban.service

and to enable it:

systemctl enable fail2ban.service

And now the classical command:

service fail2ban status | start | stop

is working.

The problem is, I read I should be able to get info of the service from systemctl too:

systemctl fail2ban status
Unknown operation fail2ban.

So I started googling results ... I found this command (and I added | sort for a better output):

systemctl list-units | sort

That shows:

fail2ban.service  loaded active exited  LSB: Start/stop fail2ban

I don't know what "exited" meant so I searched: https://unix.stackexchange.com/questions/241970/what-does-status-active-exited-mean-for-a-custom-service

State active (exited) means that systemd has successfully run the commands but that it does not know there is a daemon to monitor.

MY request:

All I wish to do is being able to start and stop and control if it's working, the fail2ban service. I don't know (almost) anything of systemd because I always skipped it (reason why I moved to Ubuntu 14 after being comfortable with CentOS 5 and previous for years) but it seems I am forced now.

Can someone tell me how I should "add" fail2ban service to systemctl in the proper way?

1 Answer 1

6

Muscle memory is a thing. The designers of the systemctl utility reordered the command line so that it is now (broadly)

systemctl <action> <service>

rather than what your muscle memory is accustomed to

systemctl <service> <action>

So, start stop, restart, enable, status etc become

systemctl start fail2ban
systemctl stop fail2ban
systemctl restart fail2ban
systemctl enable fail2ban
systemctl status fail2ban
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .