Run command or script in Raspberry Pi barely turn on [closed]

-1

BUENAS wanted to ask how it could be done so that a script or a command runs on a raspberry pi 3 as soon as it turns on. I need this to run format.js and .cmd commands

    
asked by Luis Rivera 08.06.2018 в 08:40
source

1 answer

1

You should create a bash file that executes this python program and copy it to the init.d folder, all these script are executed when the system is booted, I pass you a web page of the Pi rasperry forum where they explain it to you, it is You need to follow the one in this forum and not another as each distribution behaves differently.

link

I'll give you an example of the script that you have to do, which is the most messy thing of all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          </home/pi/hotspot>
# Required-Start:    $all
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Manage my cool stuff
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions
# If you need to source some other scripts, do it here

case "$1" in
 start)
  log_begin_msg "Starting my Hotspot service"
  python <PATH_DE_MI_PROGRAMA>
  log_end_msg $?
 exit 0
 ;;
stop)
log_begin_msg "Stopping the Hotspot service unfortunately"

# do something to kill the service or cleanup or nothing

log_end_msg $?
exit 0
;;
*)
echo "Usage: /etc/init.d/home/pi/hotspot {start|stop}"
exit 1
;;
  esac
    
answered by 08.06.2018 / 09:01
source