Skip to content

Instantly share code, notes, and snippets.

@yookoala
Last active April 16, 2020 09:53
Show Gist options
  • Save yookoala/b7ef79438e7b089568242c9cc25c4b7f to your computer and use it in GitHub Desktop.
Save yookoala/b7ef79438e7b089568242c9cc25c4b7f to your computer and use it in GitHub Desktop.
SPEC for tick5 with systemd unit.
# Some metadata required by an RPM package
Name: tick5
Summary: Print a message every 5s
Version: 0.1
Release: 1
License: MIT
%description
tick5 is a simple useless script that echos a message every 5 seconds.
%install
# copy the executable to buildroot.
mkdir -p %{buildroot}/usr/bin
cp -pdf tick5 %{buildroot}/usr/bin/tick5
chmod 755 %{buildroot}/usr/bin/tick5
# generate the systemd unit file to buildroot.
mkdir -p %{buildroot}/etc/systemd/system
cat <<EOF> %{buildroot}/etc/systemd/system/tick5.service
[Unit]
[Install]
WantedBy=multi-user.target
[Service]
ExecStart=/usr/bin/tick5 come on, James
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n
EOF
%files
/usr/bin/tick5
/etc/systemd/system/tick5.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment