How to auto start program in Linux with root privilegies

To run some script or program when computer start in linux – copy this program to /etc/init.d directory. Change permissions to 755.

For example let’s create simple bash script “ntpsync“that sync system clock with NTP server in Internet:

service ntp stop
ntpdate time.nist.gov
service ntp start

Copy this sctipt to /etc/init.d, create symbolic link to /etc/rc3.d:

ln -s /etc/init.d/ntpsync /etc/rc3.d/ntpsync

Rc3 level – Мulti-user regime width network support.

That’s all, on next startup Linux will run this script, and automatically sync system clock with NTP server from Internet.