Skip to content

Instantly share code, notes, and snippets.

@Mic92
Created September 19, 2012 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mic92/ac8ab2e84125ededa5c5 to your computer and use it in GitHub Desktop.
Save Mic92/ac8ab2e84125ededa5c5 to your computer and use it in GitHub Desktop.
some systemd unit and service files for (debian)
# IMPORTANT: only (!) compatible with dhcpcd5, not dhcpcd3
[Unit]
Description=dhcpcd on %I
Wants=network.target
Before=network.target
[Service]
Type=forking
PIDFile=/run/dhcpcd-%I.pid
ExecStart=/sbin/dhcpcd -A -q -w %I
ExecStop=/sbin/dhcpcd -k %I
[Install]
Alias=multi-user.target.wants/dhcpcd@eth0.service
[Unit]
Description=dhcpcd on %I
Wants=network.target
Before=network.target
[Service]
Type=forking
PIDFile=/run/dhcpcd-%I.pid
ExecStart=/sbin/dhcpcd -A -q -w %I
ExecStop=/sbin/dhcpcd -k %I
[Install]
Alias=multi-user.target.wants/dhcpcd@eth0.service
[Unit]
Description=Daemon which acts upon network cable insertion/removal
[Service]
Type=forking
PIDFile=/run/ifplugd.%i.pid
ExecStart=/usr/sbin/ifplugd %i
SuccessExitStatus=0 1 2
[Install]
WantedBy=multi-user.target
[Unit]
Description=Daemon which acts upon network cable insertion/removal
[Service]
Type=forking
PIDFile=/run/ifplugd.%i.pid
ExecStart=/usr/sbin/ifplugd %i
SuccessExitStatus=0 1 2
[Install]
WantedBy=multi-user.target
# This file is systemd template for monit service. To
# register # monit with systemd, place the monit.servicefile
# to the /lib/systemd/system/ directory and then start it
# using systemctl (see bellow).
#
# Enable monit to start on boot:
# systemctl enable monit.service
#
# Start monit immediately:
# systemctl start monit.service
#
# Stop monit:
# systemctl stop monit.service
#
# Status:
# systemctl status monit.service
[Unit]
Description=Pro-active monitoring utility for unix systems
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/monit -I
ExecStop=/usr/bin/monit quit
ExecReload=/usr/bin/monit reload
[Install]
WantedBy=multi-user.target
[Unit]
Description=Network Time Service
After=network.target nss-lookup.target
[Service]
Type=forking
PrivateTmp=true
ExecStart=/usr/sbin/ntpd -g -u ntp:ntp
ControlGroup=cpu:/
[Install]
WantedBy=multi-user.target
[Unit]
Description=SSH Per-Connection Server
Requires=sshdgenkeys.service
After=syslog.target
After=sshdgenkeys.service
[Service]
ExecStartPre=/bin/mkdir -m700 -p /var/run/sshd
ExecStart=-/usr/sbin/sshd -i
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
[Unit]
Conflicts=ssh.service
[Socket]
ListenStream=22
Accept=yes
[Install]
WantedBy=sockets.target
[Unit]
Description=SSH Per-Connection Server
Requires=sshdgenkeys.service
After=syslog.target
After=sshdgenkeys.service
[Service]
ExecStartPre=/bin/mkdir -m700 -p /var/run/sshd
ExecStart=-/usr/sbin/sshd -i
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
[Unit]
Description=SSH Key Generation
ConditionPathExists=|!/etc/ssh/ssh_host_key
ConditionPathExists=|!/etc/ssh/ssh_host_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key
ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key.pub
[Service]
ExecStart=/usr/bin/ssh-keygen -A
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment