ARM架构(aarch64)Ubuntu 系统搭配 Xfce桌面环境配置 Qt程序开机启动

  1. 准备工作
    在要执行的二进制可执行文件同目录下新建 run.sh 文件
    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides:          start.sh
    # Required-Start:    
    # Required-Stop:     
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: starts the exe
    # Description:       starts exe 
    ### END INIT INFO
    
    #任务脚本
    #进入要执行脚本目录
    cd /home/johnny/Documents/Demo/
    #取得root权限,'123456'为密码,不用加引号,'ls'无实际作用
    echo 123456|sudo -S ls
    #执行脚本./exe,sudo -S需要加上
    sudo -S ./exe
    #任务脚本
    

     

  2. 给run.sh 添加可执行权限
    chmod 777 run.sh

     

  3. Xfce桌面菜单 -> Settings -> Session and Startup
  4. 选择Application Autostart  
    ARM架构(aarch64)Ubuntu 系统搭配 Xfce桌面环境配置 Qt程序开机启动
  5. Add/Edit
  6. Command 中填写
    xfce4-terminal --default-working-directory=/home/johnny/Documents/Demo  --command='./run.sh'
  7. 重启搞定