stat_logger service script to put into /etc/init.d/ C code that daemonize a call to the bash script every 5min To start the service add boot time run the following command: sudo update-rc.d stat_logger start Be careful with your files permission