Ubuntu – adding startup script

Edit file: /etc/rc.local

This file will auto run at startup.


This file is a bash file, it might be run when all the services is not ready yet, such as the internet is not ready. If you run immediately, there might be some problems such as the database connection is not ready yet, you wont be able to connect to database server. It’s better to let this script to sleep for a while, then start the job. This is my file:


sleep 100 # wait for 100 seconds

php /www/jobs/update_records.php



Leave a Reply

Your email address will not be published. Required fields are marked *