Go to main content

Developing System Services in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

Periodic Services

Most system services are implemented as long-running daemons and run until an administrator intervenes. A periodic or scheduled service runs a relatively short task at regular intervals. A scheduled service is a type of periodic service. See Creating a Service to Run on a Specific Schedule for more information about scheduled services.

You might want to create a periodic service to perform a task that you previously would have configured cron to perform. One advantage of using an SMF service and delivering the service in an IPS package is that you can take advantage of SMF and IPS dependency features to ensure the task only runs when other required software is installed and running. Another advantage is that when the user uninstalls the package, the periodic task is removed and does not need to be separately removed from a crontab file.

A periodic service instance is managed by the periodic restarter, svc.periodicd, which is invoked by the svc:/system/svc/periodic-restarter service at system startup. The periodic restarter runs the start method for the instances it manages at scheduled intervals whenever the instance is in the online state. A periodic instance that is enabled transitions to the online state as soon as all of the dependencies of the instance are met. If no errors or administrative interventions occur, the periodic service remains in the online state between runs of the start method, when no processes associated with the method are running. See the svc.periodicd(1M) man page for more information.