feat: add --pidfile support for access subcommand#1623
Open
juliosuas wants to merge 1 commit intocloudflare:masterfrom
Open
feat: add --pidfile support for access subcommand#1623juliosuas wants to merge 1 commit intocloudflare:masterfrom
juliosuas wants to merge 1 commit intocloudflare:masterfrom
Conversation
Add --pidfile flag to the 'access tcp' (ssh/rdp/smb) subcommand, matching the existing behavior of 'cloudflared tunnel --pidfile'. When set, the process writes its PID to the specified file on startup and removes it on exit, enabling daemon management with systemd, launchd, or custom init scripts. Closes cloudflare#723
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
--pidfilesupport to thecloudflared access tcp(and its aliasesssh,rdp,smb) subcommand.Closes #723
Problem
The
--pidfileflag works forcloudflared tunnelbut not forcloudflared accesssubcommands. Users runningcloudflared access tcpas a daemon need pidfile support for process management with systemd, launchd, or custom init scripts.Solution
--pidfileflag on theaccess tcpsubcommand (also exposed viaTUNNEL_PIDFILEenv var, matching the tunnel command)defergo-homedirpath expansion already used by the tunnel pidfile implementationThe implementation is intentionally minimal — it follows the same pattern as the existing tunnel
--pidfilesupport.Usage
Changes
cmd/cloudflared/access/cmd.go— addedpidfileflag constant and registered the flag on thetcpsubcommandcmd/cloudflared/access/carrier.go— added pidfile write on startup with deferred cleanup on exit