首页 > 其他分享 >frp 树莓派通过systemd设置开机启动

frp 树莓派通过systemd设置开机启动

时间:2023-08-03 10:11:59浏览次数:50  
标签:树莓 20 xxx systemd raspberrypi frp frpc

树莓派操作系统为

xxx@raspberrypi: $ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/

frp 版本为 frp_0.51.2_linux_arm64.tar.gz
按照官方的教程:https://gofrp.org/docs/setup/systemd/ 使用systemctl start frps可以成功启动frpc.

但是重启树莓派的时候 frpc 提示启动成功了但是进程里无显示。

xxx@raspberrypi:~ $ sudo systemctl status frpc
● frpc.service - frp client
     Loaded: loaded (/etc/systemd/system/frpc.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Wed 2023-08-02 20:20:25 CST; 13h ago
    Process: 520 ExecStart=/home/xxx/runFrp/frpc -c /home/xxx/runFrp/frpc.ini (code=exited, status=0/SUCCESS)
   Main PID: 520 (code=exited, status=0/SUCCESS)
        CPU: 102ms

Aug 02 20:20:24 raspberrypi systemd[1]: Started frp client.
Aug 02 20:20:25 raspberrypi systemd[1]: frpc.service: Succeeded.

查看frpc进程

xxx@raspberrypi: $ ps aux | grep frpc
xxx         4215  0.0  0.0   5912   672 pts/0    S+   09:46   0:00 grep --color=auto frpc

搜索到了一篇文章https://blog.csdn.net/Ruanes/article/details/108186316

通过设置[Service]部分,当frp服务启动失败时,时隔5秒后重新启动它

添加一个参数 RestartSec=5 问题成功解决
完整systemd代码 xxx@raspberrypi: $ vi /etc/systemd/system/frpc.service

[Unit]
Description = frp client
After = network.target syslog.target
Wants = network.target

[Service]
Type=simple
ExecStart=/home/xxx/runFrp/frpc -c /home/xxx/runFrp/frpc.ini
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

修改完之后需要执行 sudo systemctl daemon-reload 使命令生效

标签:树莓,20,xxx,systemd,raspberrypi,frp,frpc
From: https://www.cnblogs.com/grj1046/p/17602518.html

相关文章

  • 树莓派设置开机启动
    树莓派设置开机启动前言树莓派设置开机自启,看了好多教程都没有成功.我是要设置树莓派开机运行一个fastapi或者flask的服务,要求该程序在后台运行创建一个bash脚本运行python程序很关键,一定要使用bash脚本去运行python程序,然后关键一步要给你的bash脚本sud......
  • Linux systemd配置
    介绍:systemd是Linux系统工具,用来启动守护进程,已成为大多数发行版的标准配置。它是一个初始化程序(init)和SystemV初始化脚本的现代替代者。Systemd可以接管后台服务、结束、状态查询,以及日志归档、设备管理、电源管理、定时任务等许多职责。Systemd是所有进程之母,负责将Linux主......
  • Systemd教程
    title:"Systemd教程"date:2023-07-31T16:05:25+08:00tags:["Linux运维"]categories:[]draft:falseSystemd入门教程:实战篇-阮一峰的网络日志配置文件$systemctlcatsshd.service[Unit]Description=OpenSSHserverdaemonDocumentation=man:sshd(8)man:ssh......
  • 树莓派的五种奇特的用途
    导读最近,我在一个电话会议上听到有人说开源社区是好奇心和解决问题的文化的结合。好奇心是我们解决问题的基础。在解决各种规模的问题时,我们使用了大量的开源工具,其中包括在功能极为方便的树莓派上运行的 Linux。我们每个人都有各种不同的生活经历,所以我向我们的作者社......
  • 使用 systemd timer 备份数据库
    定义timer文件进入目录/usr/lib/systemd/system,按如下文件建立timer:[Unit]Description=Runsdbbackupeveryhour[Timer]#TimetowaitafterbootingbeforewerunfirsttimeOnBootSec=10min#TimebetweenrunningeachconsecutivetimeOnUnitActiveSec=1hUnit=db_b......
  • Systemd 入门教程
    Systemd入门教程:命令篇Systemd是Linux系统工具,用来启动守护进程,已成为大多数发行版的标准配置。本文介绍它的基本用法,分为上下两篇。今天介绍它的主要命令,下一篇介绍如何用于实战。一、由来历史上,Linux的启动一直采用init进程。下面的命令用来启动服务。$sudo/et......
  • 自定义树莓派开机启动画面-plymouth版本
    apt-get install-yplymouth-themes#查看当前已安装的主题$plymouth-set-default-theme--listfutureprototype #默认主题,貌似和details一样details #纯文本启动日志输出joy #Debian的背景图+四个小白点循环点亮动画lines #Debian的背景图+线条绘制循环动画moon......
  • Frp内网穿透
    Frp下载地址:https://github.com/fatedier/frp/releasesWINDOWS:frp_0.51.1_freebsd_386.tar.gzFrp分为公网机器、内网机器公网机器:绑定的是frps查看需要的配置文件:[root@yydsfrp_0.51.0_linux_386]# ls......
  • minipc使用frp端口映射
    参考官网文档使用frp配置内网访问宝塔面板部署frp内网穿透FRP内网穿透实战使用场景之前购买的云服务器硬盘比较小,很快满了,加上希望将数据放本地服务器。故此某宝买了minipc,安装了Ubuntuserver。以下使用腾讯云轻量服务器centos安装frps,本地minipc系统Ubuntu安装frpc,记录......
  • 树莓派py文件自动运行
     1.Python代码autowifi.py,放在/home/pi目录下:12345678#!/usr/bin/pythonimportos,time whileTrue:    if'192'notinos.popen('ifconfig|grep192').read():        print'\n******wifiisdown,restart...****......