1

As the title saying, I want to start on this.

sudo service (my service name) start.

Where do I write this script that can make service initially start? My service is "apache2" and "bluetooth". Otherwise, I currently have a problem on bluetooth keyboard can't get automatically connected after reboot or a wake-up.

  • 2
    You don't mention what model Pi or OS/version you are running, but Raspbian will automatically start Apache and if you are using a PI3 with built in bluetooth it will also be started automatically on boot. – Steve Robillard Aug 18 '16 at 9:07
  • Sadly, I own pi-2. Are there any treatment to make it initially start? I have the other service spamassassin I want to make it initially start. Thanks. – jefferyear Aug 18 '16 at 9:12
  • 1
    @jefferyear When you install apache via sudo apt-get install it automatically starts at boot. You need to undo whatever you have done to stop it starting at boot. – joan Aug 18 '16 at 10:08
  • Without knowing what OS and version you are running we can't really answer your question. – Steve Robillard Aug 18 '16 at 12:32
  • I use Raspbian. – jefferyear Aug 19 '16 at 0:24
0

This is the way I used to schedule on reboot to start my custom monitoring scripts.

Say I have written a whatsapp service that will trigger messages to my whatsapp number when ever I have asked my Raspberry to monitor some activities at home. There are better ways to doing when it comes to services like apache/mongod etc.

cron way of doing -

  1. sudo crontab -e (select the editor of your choice like nano/vi etc. This will be a one time option asked by Pi.)
  2. @reboot service apache2 restart

Hope this helps.

| improve this answer | |
  • Thank your response so that I am able to refer to "cron" this schedule tool. I just install cron-apt to make automatically update. But, upgrade this command seems to be done by administrator. I refer some articles they suggest to do manually "apt-get upgrade" this command. I am not clearly knowing why it is to be manually. – jefferyear Aug 25 '16 at 6:38
  • As far as I know we will be using some stable versions of tools while building a project. Lets say for example when I am building an application I am using a particular version of a server(httpd). My current configurations would work fine at this point. During the subsequent release the tool vendor changes some thing and which would be a part of new release. So when we schedule some auto upgrades this might take us to trouble. Please accept the the answer you are convinced. Thank you. – Varad A G Aug 25 '16 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.