[Service] Type=idle ExecStart=/usr/bin/<scriptname>.sh 在 2014年2月18日星期二UTC+8上午3时04分09秒,[email protected]写道: > > I am trying to either get an executable or shell script to run on boot up > of my beaglebone black. I have tried a couple methods, however I am seeing > a lot of people using the service method. These are the steps I took in > creating my service file. What did I do wrong? Are there other people > having similar problems at boot up? Thanks in advance > > Running a script on Beaglebone Black boot/ startup > 1. Compile the required code. > > 2. Create a bash script that will launch the code at boot/ startup > cd /usr/bin/ > Type nano <scriptname.sh> > #!/bin/bash > /home/root/<name_of_compiled_code> > > Save and grant execute permission > chmod u+x /usr/bin/<scriptname>.sh > 3. Create the service > nano /lib/systemd/<scriptname>.service > 4. Edit the above file as necessary to invoke the different > functionalities like network. Enable these only if the code needs > > that particular service. Disable unwanted ones to decrease boot time. > [Unit] > Description=<description of code> > After=syslog.target network.target > [Service] > Type=simple > ExecStart=/usr/bin/<scriptname>.sh > [Install] > WantedBy=multi-user.target > 5. Create a symbolic link to let the device know the location of the > service. > cd /etc/systemd/system/ > ln /lib/systemd/<scriptname>.service <scriptname>.service > > 6. Make systemd reload the configuration file, start the service > immediately (helps to see if the service is functioning > > properly) and enable the unit files specified in the command line. > > systemctl daemon-reload > systemctl start <scriptname>.service > systemctl enable <scriptname>.service > > 7. Restart BBB immediately to see if it runs as intended. > shutdown -r now >
-- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
