Simpler version of upstart
With this program, you can start other programs/scripts as a daemon, save logs and respawn if ended unexpectedly. In general, this runs as a simpler version of upstart.
Definitions in fileutils.h
- DIRPATH_SERVICES("./services"): directory path of service configuration files
- DIRPATH_SERVICE_SCRIPTS("/run/shm/service"): directory of service script files
- DIRPATH_SERVICE_PIDS("/run/service"): directory of service pid files
- FILEPATH_SERVICES_LIST("/run/service/services.list"): file that contains running services
Service configuration files must have ".conf" extension.
Sample files:
# execute command
exec sleep 5
# or, you can define a script
#script
# echo "starting..."
# sleep 5
#end script
# log file path(default /dev/null)
# log /run/sample1.log
# wipe log on start/restart
# wipe log
# pid file path (default: /run/service/<service_name>.pid)
# pidfile /run/sample1.pid
# respawn service if it dies
respawn
# set respawn options
# limit: respawn limit count, default: int max
# interval: delay before start in seconds: 0
#
# respawn limit <limit> <interval
respawn limit 5 1