I have an AgentYes.py which I want to run when my BeagleBone boots up. I want to start as soon as the BeagleBone powers up. I tried to put this in /etc/init.d, but it didn’t help. I wrote a shell script to run this executable but even that did not help for me.
So, How can a run automatically python script on bootup a BBGW?
OS- debian10 (Buster)
Debian 10.x uses systemd, just create a standard systemd service file:
For example: https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/
Regards,
Thanks Robert, I will check it out and get back to you.
Thank you

i will write shell script like that and moved /etc/init.d
tried above solution but didnt help it.
This errors are facing right now.
please help Robert…
If you want help, share your current service file.
Thank you Robert, This is the service file

User=debian, but you want to use ‘sudo’… ? that means just run as root, don’t use User with sudo…
Type=simple → forking…
[Service]
Type=forking
ExecStart=/home/debian/AgentYes.py
Drop the Restart for now…
Regards,
Thank you so much, Robert, but I am facing the issue of being unable to autolaunch a dbus-daemon without a $DISPLAY for X11.
The AgentYes.py script is written to automatically accept files over Bluetooth in Beaglebone Green Wireless.
import os
import sys
import dbus
import dbus.service
import dbus.mainloop.glib
from gi.repository import GLib
BUS_NAME = 'org.bluez.obex'
PATH = '/org/bluez/obex'
AGENT_MANAGER_INTERFACE = 'org.bluez.obex.AgentManager1'
AGENT_INTERFACE = 'org.bluez.obex.Agent1'
TRANSFER_INTERFACE = 'org.bluez.obex.Transfer1'
bus = None
transfers = {}
class Transfer:
def __init__(self, watch, path, file, size=0):
self.watch = watch
self.path = path
self.file = file
self.size = size
def progress(self,amount):
percent = (amount / self.size) * 100
print("Progress: "+str(round(percent))+"%\r",end="")
def finish(self):
print("Cleaning up for "+self.file)
self.watch.remove()
# FIXME: obexd path is hardcoded, could be extracted from Session interface
os.rename(os.path.expanduser("~/.cache/obexd/")+self.file,
# GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)+"/"+self.file)
#os.rename(os.path.expanduser("~/.cache/obexd/") + self.file,
"/home/debian/DOWNLOAD/" + self.file)
def signal_handler(name,properties,ignore,path=""):
if "Size" in properties:
transfers[path].size = properties["Size"]
if "Status" in properties:
if properties["Status"] == "complete":
transfers[path].finish()
if "Transferred" in properties:
transfers[path].progress(properties["Transferred"])
class Agent(dbus.service.Object):
def __init__(self, conn=None, obj_path=None):
dbus.service.Object.__init__(self, conn, obj_path)
@dbus.service.method(AGENT_INTERFACE, in_signature="o", out_signature="s")
def AuthorizePush(self, path):
transfer = dbus.Interface(bus.get_object(BUS_NAME, path), 'org.freedesktop.DBus.Properties')
properties = transfer.GetAll(TRANSFER_INTERFACE)
filename = properties["Name"]
print("Incoming transfer: "+filename)
watch = bus.add_signal_receiver(signal_handler,path=path,path_keyword="path")
Lib.MainLoop()
manager.RegisterAgent(path)
print("Agent registered")
mainloop.run()
Here is the Python script I am using.
[Unit]
<>
After=graphical.target
Regards,
Tried above solution it fails to start service.
and this is the updated service file.

Hello Robert, Please help ! I need your help
Did you run journalctl -xe as the output suggested ?
Your python script exited, probably nothing to do with the service file.
it runs yesterday, but suddenly it showing this error.
thats the output when it runs successfully.
Another one solution i found like below mentioned steps-
- systemctl --user start obex
2.bt-obex -s ~/Downloads
3.smartphone- send file from android device
4.Ubuntu- accept the request from the bt-agent on terminal
I need to above process automatically on bootup of beaglebone.
Thank you