Posted by: kezhong | November 19, 2011

Creating my own systemd service files on Fedora 16(x86_64)

systemd is a replacement for the System V init daemon for Linux. It is intended to provide a better framework for expressing services’ dependencies, allow more work to be done in parallel at system startup, and to reduce shell overhead. It has been used starting with Fedora 15.

On my environment, the system is Fedora 16(X86_64). I want to send my radius log to another web server per 5 second so as to monitor it conveniently.

Create the script file
# vi /usr/local/bin/radinfo

while true
  ext=$(date +%y%m%d-%H%M%S)
  tail -200 /var/log/radius/radius.log > /dev/shm/radinfo
  scp /dev/shm/radinfo kezhong@$ext
  ssh kezhong@ “find /var/www/html/radinfo/ -cmin +60 -exec rm {} \;”                 
  sleep 5

Give it execute permission
# chmod u+x /usr/local/bin/radinfo

Create the service file
# vi /lib/systemd/system/radinfo.service

Description=Sending radius log to management server



Make symbolic link
# cd /etc/systemd/system/
# ln -s /lib/systemd/system/radinfo.service radinfo.service

Make systemd take notice of it
# systemctl daemon-reload

Activate a service immediately
# systemctl start radinfo.service

Enable a service to be started on bootup
# systemctl enable radinfo.service

all of systemd’s man pages



  1. Thank you. This helps me; a simple example in a simple format.

  2. Thank you, your post was very useful to me!

    Just a question: Defining “”, the symbolic link should not be in “/etc/systemd/system/”?

  3. […] scheduler. I am still learning about this, but according to the wikipedia entry and also to Kezhong’s Weblog, this daemon is meant to efficiently express services dependencies, by allowing more services to be […]

  4. I want to setup offlineimap to sync my maildir periodicaly and this is exactly what I was looking for :).

    Great post, thanks!

  5. […] Ref: […]

  6. Great example!

  7. Neat. Thanks a lot!

  8. Sometimes, you get customers who change the structure of a website, and
    the search engines still know about the old structure, so people click on links that take them to missing pages.
    This is easy to fix.

    If you want to redirect missing pages to the index.html page of a website, put this line into the .

    htaccess file inside of the root of the domain. Sometimes, this is /web or /httpdocs.

  9. Simple, and easy. Thank you so much!

  10. […] […]

  11. […] […]

  12. I like what youu guys are usuially up too. This type of clever work and exposure!
    Keep up the wonderful works guys I’ve incorporated you guys to my own blogroll.

  13. good example, Thanks

  14. Thank you for this article, it was very helpful! Systemd is a pain the ass, but it does make things easier once you get the hang of it’s commands.

  15. […] following this tutorial ( to add a new systemd .service, but it does’nt work, i did step by step correct with some […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: