start boot service in Linux

  1. Run this command
    sudo nano /etc/systemd/system/YOUR_SERVICE_NAME.service
  2. Paste in the command below. Press ctrl + x then y to save and exit
    [Unit]
    Description=lampp
     
    [Service]
    ExecStart=/opt/lampp/lampp start
    ExecStop=/opt/lampp/lampp stop
    Type=forking
     
    [Install]
    WantedBy=multi-user.target
  3. Reload services
    sudo systemctl daemon-reload
  4. Enable the service
    sudo systemctl enable YOUR_SERVICE_NAME
  5. Start the service
    sudo systemctl start YOUR_SERVICE_NAME
  6. Check the status of your service
    systemctl status YOUR_SERVICE_NAME
  7. Reboot your device and the program/script should be running. If it crashes it will attempt to restart

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *