August 17

Linux: Creating a systems service

Knockd was causing me a headache with the error “command returned non-zero status code (1)” when running with their stock init.d setup.

Rather than troubleshooting their bug I decided to create my own service that would start using the /usr/sbin/knockd directly.

Step (1) Create the startup script
nano /etc/systemd/system/knockd-security.service




Ctrl X

chmod 664 /etc/systemd/system/knockd-security.service

Step (2) Create the startup shell script
nano /usr/local/bin/

Ctrl X

chmod 744 /usr/local/bin/

Step(3) Finalization
systemctl daemon-reload
systemctl enable knockd-security.service

Step(4) Test before reboot
systemctl start knockd-security.service

Step(5) Reboot

By: Timothy Conrad

Copyright 2021. All rights reserved.

Posted August 17, 2017 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B