DavebyDay
  • News
  • Categorie
    • Dev
    • Download
    • Entertainment
    • Fix
    • Gaming
    • Hardware
    • Internet
    • News
    • Recensioni
    • Smart Tech
    • Software
    • Stampa 3D
    • Tutorial
    • Web
  • More
    Create Offline Videos with AI

    Create Offline Videos with AI

    How to update Open WebUI in Docker

    How to update Open WebUI in Docker

    Disable Web Search in Start Menu – Windows 10

    Disable Web Search in Start Menu – Windows 10

    Google Sheets find and replace with macro

    Google Sheets find and replace with macro

    Dead Pixel Test for Widescreen 21:9 – 4K

    Dead Pixel Test for Widescreen 21:9 – 4K

    Come esportare i modelli 3D di Fortnite

    Creare un Pattern con un’ immagine in Photoshop

    Installare CentOS 6.9 su una Virtual machine VMware

    Guida Rapida per utilizzo Xiaomi Yi

  • Video
  • Contatti
No Result
View All Result
  • News
  • Categorie
    • Dev
    • Download
    • Entertainment
    • Fix
    • Gaming
    • Hardware
    • Internet
    • News
    • Recensioni
    • Smart Tech
    • Software
    • Stampa 3D
    • Tutorial
    • Web
  • More
    Create Offline Videos with AI

    Create Offline Videos with AI

    How to update Open WebUI in Docker

    How to update Open WebUI in Docker

    Disable Web Search in Start Menu – Windows 10

    Disable Web Search in Start Menu – Windows 10

    Google Sheets find and replace with macro

    Google Sheets find and replace with macro

    Dead Pixel Test for Widescreen 21:9 – 4K

    Dead Pixel Test for Widescreen 21:9 – 4K

    Come esportare i modelli 3D di Fortnite

    Creare un Pattern con un’ immagine in Photoshop

    Installare CentOS 6.9 su una Virtual machine VMware

    Guida Rapida per utilizzo Xiaomi Yi

  • Video
  • Contatti
No Result
View All Result
DavebyDay
No Result
View All Result
Home Software

Raspberry Pi: come avviare programmi allo start up

Davebyday by Davebyday
Ottobre 15, 2020
in Software, Tutorial
3
178
SHARES
2.5k
VIEWS
Share on FacebookShare on Twitter

Visti gli infiniti utilizzi del raspberry pi, puo tornare utile impostare l’avvio automatico di determinati programmi che ci possono interessare.

Questa necessita mi era nata quando dovevo impostare l’avvio di “no-ip” (un servizio che permette di avere un DNS dinamico gratuitamente) allo start up di Raspberry pi.

Ci sono un sacco di modi per eseguire di un comando allo start up in Linux, il mio approccio preferito è quello di creare uno script di inizializzazione in /etc/init.d e registrarlo usando update-rc.d

In questo modo l’applicazione viene avviato e arrestata automaticamente all’avvio e allo spegnimento del sistema.

Ma veniamo alla parte pratica, apriamo il terminale e per creare lo script in /etc/init.d , digitiamo:

sudo nano /etc/init.d/NameOfYourScript

Quello che segue è un esempio basato sull’avvio del servizio no-ip [ situato in /usr /local /bin/noip]:

#! /bin/sh
# /etc/init.d/noip

### BEGIN INIT INFO
# Provides:          noip
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script start / stop a program a boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting noip"
    # run application you want to start
    /usr/local/bin/noip2
    ;;
  stop)
    echo "Stopping noip"
    # kill application you want to stop
    killall noip2
    ;;
  *)
    echo "Usage: /etc/init.d/noip {start|stop}"
    exit 1
    ;;
esac

exit 0

Attenzione – è importante testare lo script e assicurarsi chel’avvio, non ci sia bisogno di fare l’autenticazione come utente o passaggi che prevedono l’interazione dell’utente come ad essempio fornire una risposta , premere ” y” o simili , perché si possono blocchi che impediscono l’avvio dello script appena creato.

Rendiamo ora lo script eseguibile digitando,sempre da terminale:

sudo chmod 755 /etc/init.d/NameOfYourScript

Proviamo ad avviare lo script con:

Create Offline Videos with AI

Run .BAT Files in Minimized Mode

How to update Open WebUI in Docker

Disable Web Search in Start Menu – Windows 10

Google Sheets find and replace with macro

sudo /etc/init.d/NameOfYourScript start

e successivamente a stopparlo con:

sudo /etc/init.d/NameOfYourScript stop

Concludiamo registrando lo script per partire all’avvio. Per registrare lo script da eseguire all’avvio e spegnimento , eseguire il seguente comando:

sudo update-rc.d NameOfYourScript defaults

Nel caso si volesse rimuovere l’avvio dello script appena creato bastera digitare:

sudo update-rc.d -f  NameOfYourScript remove

Questo è tutto!
Hai altre domande riguardo quanto appena trattato?

Aggiungi un commento qui sotto e vedrai che troverai risposta quanto prima!

 

Post Views: 2.118
Tags: linuxRaspberry pi
Share71Tweet45SendShareShare
Previous Post

Installare Plesk Panel in Debian 7

Next Post

Cos’è Cryptsy?

Related Posts

Create Offline Videos with AI
AI

Create Offline Videos with AI

by Davebyday
Maggio 21, 2025
6
Run .BAT Files in Minimized Mode
Dev

Run .BAT Files in Minimized Mode

by Davebyday
Maggio 10, 2025
36
How to update Open WebUI in Docker
AI

How to update Open WebUI in Docker

by Davebyday
Aprile 7, 2025
481
Disable Web Search in Start Menu – Windows 10
Fix

Disable Web Search in Start Menu – Windows 10

by Davebyday
Maggio 3, 2024
37
Google Sheets find and replace with macro
Dev

Google Sheets find and replace with macro

by Davebyday
Settembre 20, 2022
471
Next Post

Cos'è Cryptsy?

Come rendere un' immagine Responsive

Please login to join discussion

Recommended Stories

Create Offline Videos with AI

Create Offline Videos with AI

Maggio 21, 2025
6
AI Startup System Prompts Leaked

AI Startup System Prompts Leaked

Maggio 19, 2025
22
Run .BAT Files in Minimized Mode

Run .BAT Files in Minimized Mode

Maggio 10, 2025
36
Absolute Zero – Self-Improvement AI

Absolute Zero – Self-Improvement AI

Maggio 19, 2025
14
What is Model Context Protocol

What is Model Context Protocol

Maggio 19, 2025
13
How to update Open WebUI in Docker

How to update Open WebUI in Docker

Aprile 7, 2025
481
  • Configurare Raspberry Pi come Access Point Bridge

    223 shares
    Share 89 Tweet 56
  • Trovare file con percorso più lungo di 255 caratteri

    202 shares
    Share 81 Tweet 51
  • Raspberry Pi: come avviare programmi allo start up

    178 shares
    Share 71 Tweet 45
  • Mega.co.nz non si apre

    174 shares
    Share 70 Tweet 44
  • Come abilitare il login per l’utente root nella GUI Debian

    151 shares
    Share 60 Tweet 38
  • Home Assistance Compatible Device
  • My Setup
  • News
  • Web Tech & DIY

© 2020

No Result
View All Result
  • Home Assistance Compatible Device
  • My Setup
  • News
  • Web Tech & DIY

© 2020