Run a single line command on Debian upon startup?

Zirius

New member
Messages
261
Points
0
Hello! At is seems, my server's time is off by 4mins, now I have to run:

sudo ntpdate ntp.pagasa.dost.gov.ph
everytime I reboot, which sometimes I forgot to run, is there a way that command be run immediately after startup?

thanks!

 
my-super-script.sh

#!/bin/bash/usr/sbin/ntpdate ntp.pagasa.dost.gov.ph
put it into /etc/init.d folder:

mv my-super-script.sh /etc/init.d/ 

Set it executable:

chmod +x /etc/init.d/my-super-script.sh 


Create symlink to /etc/rc.d folder

Code:
ln -s /etc/init.d/my-super-script.sh /etc/rc.d/ 
 
Back
Top