Fix cloudflared service with preStart script to ensure log directory and file exist
This commit is contained in:
parent
6419e44222
commit
0c2f06bd72
1 changed files with 7 additions and 0 deletions
|
|
@ -26,6 +26,13 @@ in {
|
|||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# Create directory for log files
|
||||
preStart = ''
|
||||
mkdir -p "$(dirname ${tunnel.logPath})"
|
||||
touch ${tunnel.logPath}
|
||||
chmod 644 ${tunnel.logPath}
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.cloudflared}/bin/cloudflared access tcp --hostname ${tunnel.remoteHost} --url ${tunnel.remoteTarget} --port ${toString tunnel.localBindPort} --logfile ${tunnel.logPath}";
|
||||
Restart = "always";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue